开发者

Android Multipart SMSes - received separately

开发者 https://www.devze.com 2023-04-01 02:27 出处:网络
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.

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,开发者_如何学Go 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.


For those of you who are looking for how I solved this problem, this is what I did :

Sender:

  • Instead of using the built in divideMessage, I created my own divideMessage which returns an ArrayList<String>, in which each element will have a prefix and whose length is <= 150 (Empirically found number).
  • send the above obtained ArrayList<String> of Messages using the built in sendMultipartTextMessage.

Receiver:

  • Get the prefix of the message and store the message in a local db.
  • From the prefix see if its all other parts have arrived. If yes, merge all the parts and process it.

Note: whats contained in prefix and how all parts are merged is not in the purview of this discussion.

0

精彩评论

暂无评论...
验证码 换一张
取 消