Android 多部分短信 - 单独接收
我正在开发一个短信网关应用程序,它从客户端应用程序接收短信,对其执行一些操作并将数据上传到服务器。
在客户端应用程序中,当消息长度超过 160 个字符时,我会在使用 divideMessage
方法拆分消息后执行 sendMultipartTextMessage
。然而,当 SMS 网关设备接收到消息时,BroadcastReceiver
的 onReceive
每次调用仅获取一个 PDU 以及消息的不同部分。收到的相同短信是不同的短信。
是否有一些设置可以接收多部分短信?我使用华为 u8150 Helios 设备作为网关。我已经对设备进行了 root 操作,如果需要,我可以更改系统设置。
提前致谢。
I am developing an SMS gateway application which receives the sms'es from the client app, performs some operation on it and uploads the data to the server.
From the client app, when the message length grows beyond 160 Characters, I do a sendMultipartTextMessage
after splitting the message using the divideMessage
method. However, when the message is received in the SMS gateway device, the onReceive
of the BroadcastReceiver
gets only one PDU per call and different parts of the same sms is being received as different sms.
Is there some setting to enable receiving multipart sms'es? I'm using Huawei u8150 Helios device for the gateway. I have rooted the device and if needed I can change the system settings.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些正在寻找我如何解决此问题的人,这就是我所做的:
Sender:
divideMessage
,而是创建了自己的divideMessage
返回一个ArrayList
,其中每个元素都有一个前缀,其长度 <= 150(经验发现的数字)。sendMultipartTextMessage
发送上面获得的ArrayList
消息。接收者:
注意:前缀包含什么以及如何合并所有部分不属于本次讨论的范围。
For those of you who are looking for how I solved this problem, this is what I did :
Sender:
divideMessage
, I created my owndivideMessage
which returns anArrayList<String>
, in which each element will have a prefix and whose length is <= 150 (Empirically found number).ArrayList<String>
of Messages using the built insendMultipartTextMessage
.Receiver:
Note: whats contained in prefix and how all parts are merged is not in the purview of this discussion.