在Android中编码SMS消息 [英] Encoding SMS messages in Android

查看:248
本文介绍了在Android中编码SMS消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,我想要发送某个类的短信和一定的编码。 (类0和7位编码)。

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).

当检查Android.Telephony.SmsManager和SmsMessage没有那么多你可以做。 SmsManager提供了两个函数
SendTextMessage和SendDataMessage。第一个工作正常,如果你只是想发送一个正常的短信给某人。
所以我想SendDataMessage是我不知何故需要使用的函数。但我不知道如何使用它。并且似乎没有在网上的例子(我可以找到)任何人使用此功能。

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.

有谁知道任何东西,会帮助我吗? :-)
要么如何发送Class0 7位编码的sms,要么如何正确使用SendDataMessage函数。

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.

推荐答案

sendDataMessage 函数添加了自己的用户数据头, UDH ,信息包括应用程序端口号和TP-Data-Coding-Scheme of no class,8 bit data 0x04 (位于 SmsMessage 代码库)

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)

c $ c> SendTextMessage 函数将发送具有GSM7packed编码和 0x00 的TP数据编码方案的消息 - 未压缩,默认)编码,没有类。按照GSM 03.38规范

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

对于0类,7位数据,你会寻找一个 0x10 在TP-Data-Encoding-Scheme字节位置。
为此,需要控制所有发送的PDU。目前这不是公开的android API支持。但是,您可以通过内部API的反射来完成(尽管非常不鼓励)。

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.

请参阅 Android中的SMS raw pdu

这篇关于在Android中编码SMS消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆