sendMultipartTextMessage 作为多条 SMS 消息发送?

sendMultipartTextMessage sending as multiple SMS messages?

我正在 Android 使用以下代码发送长短信:

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

问题是,在 Lollipop 5.0 之前的手机上(主要在 Kitkat 4.4 上注意到),SMS 是作为两个单独的 SMS 而不是合并的(多部分)消息发送的。

在 运行 Lollipop 5.0+ 的手机上,消息是否作为长短信正确发送?

我已经在两部完全相同型号的手机上对此进行了测试,一部是 运行 4.4 Kitkat,另一部更新为 5.0 Lollipop,是否出现了上述相同的行为?有没有其他人注意到这一点或找到了解决方案?

"The maximum length of each SMS text message can vary by carrier, but are typically limited to 160 characters. As a result longer messages need to be broken into series of smaller parts. The SmsManager includes the divideMessage() method, which accepts a string as an input and breaks it into an ArrayList of messages, wherein each part is less than the maximum allowable size.

We can then use sendMultipartTextMessage() method on the SmsManager to transmit the array of messages..."

取自:http://www.compiletimeerror.com/2013/10/send-multiparttextmessge-in-android.html?m=1

当消息足够长时,通常超过 160 个字符,它会作为单独的 SMS 消息发送,并且在 GSM 网络上会添加一些额外的元数据,称为用户数据 Header (UDH)告诉接收者应该合并单独的消息。

您希望接收方将它们组合回一条消息。请注意,它是 receiver 将它们组合在一起,因此这就是您需要查看的地方。据我所知,Lollipop 中的 sendMultipartTextMessage 行为与 KitKat 中的行为相同。