One Plus设备在尝试发送SMS时以语法方式获取异常Java.lang.Security Exception时获取异常。
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();
}
所有设备都正常运行,唯一的问题是一加设备