首页 > 解决方案 > 发送短信时一加设备问题

问题描述

One Plus 设备问题在尝试以语法方式获取异常 Java.lang.Security Exception 的发送 SMS 时获取异常。

            try {
                String message=selectedContactsMap.get(mobileNumber);

/*                SmsManager smsManager = SmsManager.getDefault();
                smsManager.sendTextMessage(mobileNumber,null, message,
                        null, null);*/

                SmsManager sm = SmsManager.getDefault();
                ArrayList<String> parts =sm.divideMessage(message);
                int numParts = parts.size();

                ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
                ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();

                for (int i = 0; i < numParts; i++) {
                    sentIntents.add(PendingIntent.getBroadcast(context, 0, new Intent(SMS_SENT), 0));
                    deliveryIntents.add(PendingIntent.getBroadcast(context, 0, new Intent(SMS_DELIVERED), 0));
                }

                sm.sendMultipartTextMessage(mobileNumber,null, parts, sentIntents, deliveryIntents);

                new Handler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(Birthday.this,"Send Message Successfully",Toast.LENGTH_SHORT).show();
                        progressDialog.dismiss();
                    }
                }, 1000);



            } catch (Exception e) {

//                    Toast.makeText(Birthday.this,"Something went 
 // wrong.",Toast.LENGTH_SHORT).show();
                Toast.makeText(Birthday.this,"Error:- 
   "+e.toString(),Toast.LENGTH_SHORT).show();
                e.printStackTrace();`enter code here`
                progressDialog.dismiss();

        }

所有设备都运行良好唯一的问题是一加设备

标签: androidarrays

解决方案


推荐阅读