N-JOY
N-JOY

Reputation: 7635

Unable to send SMS message in Hindi

I am facing a strange issue with SMSManager in Android. I am sending SMS messages in two languages, Hindi and English. Message sending works fine for English messages but messages don't get delivered in case of Hindi text. I don't even receive any broadcast of failure or success for Hindi messages.

Here is my code for sending messages.

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(destinationAddress, null, message, null, null);

PS.

I have prepared a sample app that sends messages. It works fine when messages are typed in EditText in Hindi language but unable to send messages when Hindi string is hardcoded.

i.e.

String hindiMessage = editText.getText.toString()// works fine  

String hindiMessage = "हिन्दी संदेश"//fails

I am looking for any possible solution or workaround.

Upvotes: 1

Views: 2749

Answers (1)

N-JOY
N-JOY

Reputation: 7635

This has got resolved by sending message as a multipart message. SMS were working in english language because the length of the messages that i was sending were less than maximum length of one message. But after converting it to hindi its length increases and exceeds the maximum limit of one message.

So sending messages as multipart message worked for me. here is the code for the same:

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

Upvotes: 8

Related Questions