Trouble With Sendmultiparttext In Android
I recently ran into a little trouble with sending SMSes as sendTextMessage can only send SMSes of 160 characters or lower. I, however, wish to send a long text wishing to prompt an
Solution 1:
Change your code as for sending message using sendMultipartTextMessage:
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(text);
ArrayList<PendingIntent> sentPIarr = new ArrayList<PendingIntent>();
ArrayList<PendingIntent> deliveredPIarr = new ArrayList<PendingIntent>();
for (int i = 0; i < parts.size(); i++) {
sentPIarr.add(PendingIntent.getBroadcast(this, 0,new Intent(SENT), 0));
deliveredPIarr.add(PendingIntent.getBroadcast(this, 0,new Intent(DELIVERED), 0));
}
sms.sendMultipartTextMessage(phoneNo, null, parts, sentPIarr, deliveredPIarr);
because sendMultipartTextMessage method take ArrayList as fourth and fifth param of pendingIntents
Post a Comment for "Trouble With Sendmultiparttext In Android"