SmsManager.InjectSmsPdu(Byte[], String, PendingIntent) Method

Definition

Inject an SMS PDU into the android application framework.

[Android.Runtime.Register("injectSmsPdu", "([BLjava/lang/String;Landroid/app/PendingIntent;)V", "", ApiSince=22)]
public void InjectSmsPdu (byte[]? pdu, string? format, Android.App.PendingIntent? receivedIntent);
[<Android.Runtime.Register("injectSmsPdu", "([BLjava/lang/String;Landroid/app/PendingIntent;)V", "", ApiSince=22)>]
member this.InjectSmsPdu : byte[] * string * Android.App.PendingIntent -> unit

Parameters

pdu
Byte[]

is the byte array of pdu to be injected into android application framework

format
String

is the format of SMS pdu (SmsMessage#FORMAT_3GPP or SmsMessage#FORMAT_3GPP2)

receivedIntent
PendingIntent

if not NULL this PendingIntent is broadcast when the message is successfully received by the android application framework, or failed. This intent is broadcasted at the same time an SMS received from radio is acknowledged back. The result code will be android.provider.Telephony.Sms.Intents#RESULT_SMS_HANDLED for success, or android.provider.Telephony.Sms.Intents#RESULT_SMS_GENERIC_ERROR or #RESULT_REMOTE_EXCEPTION for error.

Attributes

Remarks

Inject an SMS PDU into the android application framework.

Requires permission: android.Manifest.permission#MODIFY_PHONE_STATE or carrier privileges per android.telephony.TelephonyManager#hasCarrierPrivileges.

<p class="note"><strong>Note:</strong> This method is intended for internal use by carrier applications or the Telephony framework and will never trigger an SMS disambiguation dialog. If this method is called on a device that has multiple active subscriptions, this SmsManager instance has been created with #getDefault(), and no user-defined default subscription is defined, the subscription ID associated with this message will be INVALID, which will result in the SMS being injected on the subscription associated with logical slot 0. Use #getSmsManagerForSubscriptionId(int) to ensure the SMS is delivered to the correct subscription.

Java documentation for android.telephony.SmsManager.injectSmsPdu(byte[], java.lang.String, android.app.PendingIntent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to