send a msg using sendDataMessage() for more than 133bytes

Quickly share your Android Code Snippets here...

send a msg using sendDataMessage() for more than 133bytes

Postby bindu_kalivar » Thu Oct 20, 2011 1:32 pm

I am developing an SMS application where i am sending a message using sendDataMessage function of API level 3,but if i try to send more than 133 bytes i am getting a null pointer exception as shown below

WARN/System.err(223):java.lang.NullPointerException WARN/System.err(223):at android.telephony.SmsMessage$SubmitPdu.(SmsMessage.java:100) WARN/System.err(223):at android.telephony.SmsMessage.getSubmitPdu(SmsMessage.java:425) WARN/System.err(223):at android.telephony.SmsManager.sendDataMessage(SmsManager.java:196)

Is there any other method which sends more than 133 bytes in a single shot.?????
bindu_kalivar
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 20, 2011 1:27 pm

Top

Re: send a msg using sendDataMessage() for more than 133byt

Postby YaRi » Wed Nov 16, 2011 12:53 pm

Split the long message to several shorter messages using:
SmsManager.divideMessage and SmsManager.sendMultipartTextMessage
But these require API level 4.
http://developer.android.com/reference/ ... nager.html
YaRi
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed Nov 16, 2011 12:35 pm
Location: Finland

Re: send a msg using sendDataMessage() for more than 133byt

Postby bindu_kalivar » Thu Dec 15, 2011 12:05 pm

thanks for the reply.
If i use sendMultiPartTextMessage it'll go the native inbox of android.
but according to my application message should go to specific port.
Is there any way to send message of length is more than 133 characters to specific port ?
bindu_kalivar
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 20, 2011 1:27 pm

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 5 guests