我的应用程序正在发送自动短信。问题是它适用于所有手机,但不适用于 LG 设备。那是我的代码:
private void sendSMS(String phoneNumber, String message) {
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(message);
sms.sendMultipartTextMessage(phoneNumber, null, parts, null,
null);
}
这就是错误日志:
java.lang.NullPointerException
at com.lge.mdm.uimanager.adapter.LGMDMUIMessageAdapter.isAllowSendMessage(LGMDMUIMessageAdapter.java:50)
at com.lge.mdm.MDMInterfaceImpl.isAllowSendMessage(MDMInterfaceImpl.java:108)
at android.telephony.SmsManager.sendMultipartTextMessage(SmsManager.java:354)
at berg.royi.donotdisturbe.free.service.DNDservice.sendSMS(DNDservice.java:120)
at berg.royi.donotdisturbe.free.service.DNDservice.onHandleIntent(DNDservice.java:95)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
这是什么“LGMDMUIMessageAdapter.isAllowSendMessage”?我该如何允许?我看到一些关于在从 LG 设备发送短信时需要添加可选字段的问题,但仅此而已,没有其他解释。谢谢!