How to send the SMS more than 160 character?

Girish Bhutiya picture Girish Bhutiya · Jul 5, 2011 · Viewed 29.9k times · Source

How to send big SMS in android. I used :

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(contactNos[j], null,msgs[i], sentPI, deliveredPI);

this code work only for 160 character message. i also use

ArrayList<String> msgsplit=sms.divideMessage(msgs[i]);
ArrayList<PendingIntent> listOfIntents = new ArrayList<PendingIntent>(); 

for (int k=0; k < msgsplit.size(); k++){  
    Intent sentIntent = new Intent(); 
    PendingIntent pi = PendingIntent.getBroadcast(MultipleMsg.this, 0, sentIntent, PendingIntent.FLAG_CANCEL_CURRENT);  
    listOfIntents.add(pi);  
}
// sendMessage(contactNos[j],msgs[i]);
sms.sendMultipartTextMessage(contactNos[j],null,msgsplit, listOfIntents, null);

But it sends junk character in the message. Can anyone help me?

Answer

ingsaurabh picture ingsaurabh · Jul 5, 2011

Try below code might help

SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(message);
sms.sendMultipartTextMessage(phoneNumber, null, parts, null, null);