If I send the following.
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("2064035760", null, "Message", null, null);
It throws the following exception.
I have the proper permissions.
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(Th开发者_高级运维readPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1027)
See this question. Have you tried using sendMultipartTextMessage? It seems that if the message is too long it will throw a NullPointerException (why I don't know). I realize your message only says "Message", but it is worth a try.
精彩评论