有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Android中的java SMS原始pdu

1)有没有办法从安卓设备发送原始短信PDU

或者

2)是否有任何类可以让我访问PDU头(例如TP-DCS),以便我可以随心所欲地构建PDU

我在网上搜索发现: http://www.安卓javadoc.com/1.0_r1_src/com/安卓/internal/telephony/gsm/ISms.html 但是上面的课程是私人的,因此我无法使用(我还不知道为什么)

我所问的有可能吗?如果不是的话,为什么我不能有这种功能

坦克斯


共 (1) 个答案

  1. # 1 楼答案

    这是公共API的requested特性

    开发人员的注释提示使用内部SMSDispatcherAPI中的sendRawPdu,这可以通过reflection完成。然而,极不鼓励在生产代码中使用私有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) {
    

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