2
如果我發送以下內容。SmsManager NullPointer異常。困惑...這麼簡單,應該工作
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("2064035760", null, "Message", null, null);
它引發以下異常。
我有適當的權限。
java.lang.NullPointerException
at android.telephony.SmsMessage$SubmitPdu. (SmsMessage.java:140)
at android.telephony.SmsMessage.getSubmitPdu(SmsMessage.java:624)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:228)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:109)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1027)