Shaji Thorn Blue
Shaji Thorn Blue

Reputation: 551

Application force close while sending sms

I am developing an application which will send sms directly from my application, here is the code iam using to send and sms, if i replace finalmessage with some character like "hello" it work fine.. but if i use finalmessage it will simply force close.. and one more thing finalmessage contains around 500 character. So i still dont understand what is the problem and why it getting force close.

SmsManager sm = SmsManager.getDefault();
PendingIntent sent = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
PendingIntent delivered = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
sm.sendTextMessage(stringnumber, null,finalmessage, sent, delivered);    

Upvotes: 0

Views: 222

Answers (1)

kalyan pvs
kalyan pvs

Reputation: 14590

Its because

sm.sendTextMessage(stringnumber, null,finalmessage, sent, delivered);

it will send only the sms characters less than 160 only if you want to send sms with more than 160 characters then you need to use the method

sendMultipartTextMessage(String destinationAddress, String scAddress, ArrayList<String> parts, ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents)

check here for more details..SmsManager

Upvotes: 1

Related Questions