October 2018
Intermediate to advanced
464 pages
15h 17m
English
Although it can vary depending on the carrier, 160 is typically the maximum characters allowed per text message. You could modify the preceding code to check whether the message exceeds 160 characters, and if so, you can call the SMSManager divideMessage() method. The method returns ArrayList, which you can send to sendMultipartTextMessage(). Here's an example:
ArrayList<String> messages=smsManager.divideMessage(msg);smsManager.sendMultipartTextMessage(phoneNumber, null, messages, null, null);