SMS raw pdu в Android
1) Можно ли как-нибудь отправить необработанный SMS PDU с устройства Android?
Или же,
2) есть ли доступные классы, которые могут дать мне доступ к заголовкам PDU (например, TP-DCS), чтобы я мог создавать PDU так, как мне нравится?
Я искал в сети и обнаружил: http://www.androidjavadoc.com/1.0_r1_src/com/android/internal/telephony/gsm/ISms.html но вышеупомянутые классы являются частными и как таковые не доступны для меня (убежище на самом деле не понимаю, почему).
Возможно ли то, что я спрашиваю, или нет? Если нет, то почему я не могу иметь такую функциональность?
Thanx
2 ответа
Это запрашиваемая функция для публичного API.
Комментарии разработчиков намекают на использование sendRawPdu
из внутреннего SMSDispatcher
API, который можно сделать с помощью отражения. Тем не менее, использование частных 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) {
В заключение: не ясно, возможно ли это. У меня такой же вопрос, как и у вас.
Я знаю как. http://www.silentservices.de/products/android-hushsms/ и xposed
фреймворк http://repo.xposed.info/module/de.robv.android.xposed.installer
Вам нужно будет рутировать свой телефон, чтобы использовать xposed
модуль 'raw-pdu', но он работает. Hush-sms предоставляет API-функциональность / расширяемость для отправки 7 необработанных типов sms.