Description
I was trying to send sms from plyer recently and struggled to understand why some of them did not work. I learned in the process that:
- sms are actually limited to 160 encoded characters,
- when they don't contains ascii characters, the message is utf-16 encoded hence the limit on the message becomes quite low.
- there are two methods provided by android.telephony.SmsManager
- divideMessage gets the message and returns an array of single sms messages
- sendMultipartTextMessage gets as input the array returned by divideMessage and sends several sms as if it was a single message
I realize that this is was happens behind the hood in the default sms app.
You can see here that the application informs me that the message will be actually split in two and that I only have 20 characters left in my message.
When removing the ê
, I can type more words before the application let me know of the limit.
So, I tried replacing sms.sendTextMessage(recipient, None, message, None, None)
by sms.sendMultipartTextMessage(recipient, None, sms.divideMessage(message), None, None)
And it worked like a charm. I don't have message silently failing anymore.
I'm asking therefore if a pull request doing just that would be accepted? I don't know anough about android and the sms world to tell if there are reasons not to do that.
What do you think?