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 owndivideMessage
which returns anArrayList<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 insendMultipartTextMessage
.
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.
精彩评论