Android中的短信原始pdu

时间:2010-09-14 21:36:30

标签: java android mobile sms pdu

1)有什么方法可以从Android设备发送原始SMS PDU吗?

或者,

2)是否有可用的类可以让我访问PDU头(例如TP-DCS),以便我可以按照自己的意愿构建PDU?

我搜索了网,发现: http://www.androidjavadoc.com/1.0_r1_src/com/android/internal/telephony/gsm/ISms.html 但是上面的类是私有的,因此我无法使用(实际上并没有理解为什么)。

我能以任何方式提出要求吗?如果没有那么为什么我不能拥有那种功能呢?

感谢名单

2 个答案:

答案 0 :(得分:5)

这是公共API的requested功能。

开发者评论暗示使用内部sendRawPdu API中的SMSDispatcher,可以通过reflection完成。但是,强烈建议不要将私有API用于生产代码

目前尚不清楚是否可以使用公开TelephonyManager API发送。

/*
 * TODO(cleanup): It looks like there is now no useful reason why
 * apps should generate pdus themselves using these routines,
 * instead of handing the raw data to SMSDispatcher (and thereby
 * have the phone process do the encoding).  Moreover, CDMA now
 * has shared state (in the form of the msgId system property)
 * which can only be modified by the phone process, and hence
 * makes the output of these routines incorrect.  Since they now
 * serve no purpose, they should probably just return null
 * directly, and be deprecated.  Going further in that direction,
 * the above parsers of serialized pdu data should probably also
 * be gotten rid of, hiding all but the necessarily visible
 * structured data from client apps.  A possible concern with
 * doing this is that apps may be using these routines to generate
 * pdus that are then sent elsewhere, some network server, for
 * example, and that always returning null would thereby break
 * otherwise useful apps.
 */

/**
 * Get an SMS-SUBMIT PDU for a destination address and a message
 *
 * @param scAddress Service Centre address.  Null means use default.
 * @return a <code>SubmitPdu</code> containing the encoded SC
 *         address, if applicable, and the encoded message.
 *         Returns null on encode error.
 * @hide
 */
public static SubmitPdu getSubmitPdu(String scAddress,
        String destinationAddress, String message,
        boolean statusReportRequested, byte[] header) {

总结: 目前尚不清楚是否有可能。我和你有同样的问题。

答案 1 :(得分:1)

我知道怎么做。 http://www.silentservices.de/products/android-hushsms/xposed框架http://repo.xposed.info/module/de.robv.android.xposed.installer
您需要使用手机来使用xposed模块&#39; raw-pdu&#39;,但它可以正常工作。 Hush-sms提供api功能/可扩展性来发送7种原始短信类型。