Skip to content

Conversation

@Px-Factor
Copy link

Change sendTextMessage to sendMultipartTextMessage to add support to
message with over 140 characters.

Change sendTextMessage to sendMultipartTextMessage to add support to
message with over 140 characters.
@Px-Factor
Copy link
Author

Hi,

When using this module for an application I am working on, some of the client's testers kept telling me that they cannot send SMSs from the application, something which I could not recreate. The application's messages are predefined strings with placeholders for input entered by the user, and are then trimmed to contain 140 exactly.
Eventually I realised that those testers were using Hebrew characters in their inputs, which, due to character encoding to non-Latin characters, take more than one character when sending the SMS, hence failing to send a message containing Hebrew characters.
I have therefore made changes to your module to use the sendMultipartTextMessage which divides the string into chunks of 140 characters and send multiple SMSs, one for each chunk.

The main difference to note here is the "complete" event listener. Since strings over 140 characters are divided to more than one message, messages of over 140 characters (or message of 140 characters that contain non-Latin characters) will fire more than one "complete" event. I guess this could be dealt with in the sent and delivered intents to fire only once, but this is not required for the application I am working on, so I didn't do it.

I have changed the version number to 1.0.1 to reflect those changes, and also built a new module zip for people to use.

Thank you for the great module, and have a nice day.

Golan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants