7

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

或者,

2) 是否有任何可用的类可以让我访问 PDU 标头(例如 TP-DCS),以便我可以根据需要构建 PDU?

我在网上搜索并发现: http ://www.androidjavadoc.com/1.0_r1_src/com/android/internal/telephony/gsm/ISms.html 但上述课程是私有的,因此对我不可用(避风港'实际上不明白为什么)。

我要问的是否有可能?如果没有,那为什么我不能拥有那种功能呢?

谢谢

4

2 回答 2

6

这是公共 API 的请求功能。

开发人员评论提示使用sendRawPdu内部SMSDispatcherAPI,这可以通过反射来完成。但是,强烈建议不要将私有 API 用于生产代码

目前尚不清楚是否可以使用公共TelephonyManagerAPI 发送。

/*
 * 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) {

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

于 2011-02-19T21:40:48.643 回答
2

我知道该怎样。http://www.silentservices.de/products/android-hushsms/xposed框架http://repo.xposed.info/module/de.robv.android.xposed.installer
你需要root你的手机才能使用xposed模块'raw-pdu'的,但它有效。Hush-sms 提供 api 功能/可扩展性来发送 7 种原始短信类型。

于 2014-06-16T06:01:38.677 回答