无法在印地语中发送短信

问题描述 投票:1回答:1

我在Android中遇到SMSManager的奇怪问题。我正在用两种语言(印地语和英语)发送短信。邮件发送对于英语邮件来说效果很好,但是如果使用印地语文本,则邮件不会发送。我什至没有收到关于印地语消息失败或成功的任何广播。

这是我用于发送消息的代码。

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

PS。

我已经准备了一个示例应用程序,用于发送消息。当使用印地语以EditText键入消息时,它工作正常,但是当对印地语字符串进行硬编码时,则无法发送消息。

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

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

我正在寻找任何可能的解决方案或解决方法。

android sms
1个回答
8
投票

此问题已通过将消息作为多部分消息发送来解决。 SMS正在使用英语,因为我发送的消息的长度小于一条消息的最大长度。但是将其转换为印地语后,其长度会增加并超过一条消息的最大限制。

所以将消息作为多部分消息发送对我有用。这是相同的代码:

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

谢谢N_JOY。

© www.soinside.com 2019 - 2024. All rights reserved.