Encoding SMS messages in Android

懵懂的女人 提交于 2019-12-03 08:51:52

问题


My problem is that I want to send an SMS message of a certain Class and with a certain encoding. (Class 0 and 7-bit encoding).

When checking the Android.Telephony.SmsManager and SmsMessage there is not so much you can do. The SmsManager offers the two functions SendTextMessage and SendDataMessage. The first one works fine if you simply wants to send a normal SMS to somebody. So I guess that the SendDataMessage is the function that I somehow needs to use. However I can not figure out how to use it. And there seems to be no examples on the web (that I can find) of anyone using this function.

Does anyone know anything that would help me? :-) Either how to send a Class0 7-bit encoded sms, or how to use the SendDataMessage function properly.


回答1:


The sendDataMessage function adds it's own user data header, UDH, information consisting of the application port number and a TP-Data-Coding-Scheme of no class, 8 bit data 0x04 (found in the SmsMessage code base)

the SendTextMessage function will send the message with GSM7packed encoding and a TP-Data-Encoding-Scheme of 0x00 - uncompressed, default (7bit) encoding, no class. Per the GSM 03.38 spec

For class 0, 7 bit data, you'd be looking for a 0x10 value in the TP-Data-Encoding-Scheme byte location. To do so, one would need to control all of the PDU being sent. Currently this is not supported by the public android API. However, it can be done (though highly discouraged) via reflection on the internal APIs.

See SMS raw pdu in Android



来源:https://stackoverflow.com/questions/2694500/encoding-sms-messages-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!