-1

I am working on writing creating a new app which will send messages to any mobile device native SMS app.

while sending messages, instead of ASCII, I am using some UTF-8 encoding characters which are being replaced in between few ASCII characters of a string.

I am facing an exception while sending the message after giving the recipients number. The above utility method will look up for corresponding UTF code, when I send on button click, following exception comes:

java.lang.NullPointerException
android.telephony.SmsMessage$SubmitPdu.<init>(SmsMessage.java:168)
android.telephony.SmsMessage.getSubmitPdu(SmsMessage.java:1114)
android.telephony.SmsManager.sendTextMessage(SmsManager.java:248)
android.telephony.SmsManager.sendTextMessage(SmsManager.java:122)
com.mastpro.dpsu.stegosms.SendCipherMsgActivity.onSendClick(SendCipherMsgActivity.java:60)
Anthon
  • 69,918
  • 32
  • 186
  • 246
subash
  • 21
  • 3
  • Please post your code for SendCipherMsgActivity.java, especially line 60. Your problem is impossible to understand from the description alone. – Karl-Bjørnar Øie Apr 18 '15 at 20:56

1 Answers1

0

You should use sendMultipartTextMessage instead of sendTextMessage for the message, see Android: Unicode/Charset problems when sending an SMS (sendTextMessage)

Community
  • 1
  • 1
Alex
  • 21,273
  • 10
  • 61
  • 73