gpt4 book ai didi

java - Android 中的 SMS 原始 pdu

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:58:40 25 4
gpt4 key购买 nike

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

或者,

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

我在网上搜索了一下,发现: http://www.androidjavadoc.com/1.0_r1_src/com/android/internal/telephony/gsm/ISms.html但是上面的类是私有(private)的,因此我无法使用(实际上还不明白为什么)。

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

谢谢

最佳答案

这是一个 requested公共(public) API 的功能。

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

尚不清楚是否可以使用公共(public) 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) {

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

关于java - Android 中的 SMS 原始 pdu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3713094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com