Freigeben über


SmsManager.CreateAppSpecificSmsTokenWithPackageInfo Method

Definition

Create a single use app specific incoming SMS request for the calling package.

[Android.Runtime.Register("createAppSpecificSmsTokenWithPackageInfo", "(Ljava/lang/String;Landroid/app/PendingIntent;)Ljava/lang/String;", "", ApiSince=29)]
public string? CreateAppSpecificSmsTokenWithPackageInfo (string? prefixes, Android.App.PendingIntent intent);
[<Android.Runtime.Register("createAppSpecificSmsTokenWithPackageInfo", "(Ljava/lang/String;Landroid/app/PendingIntent;)Ljava/lang/String;", "", ApiSince=29)>]
member this.CreateAppSpecificSmsTokenWithPackageInfo : string * Android.App.PendingIntent -> string

Parameters

prefixes
String

this is a list of prefixes string separated by REGEX_PREFIX_DELIMITER. The matching SMS message should have at least one of the prefixes in the beginning of the message.

intent
PendingIntent

this intent is sent when the matching SMS message is received.

Returns

Token to include in an SMS message.

Attributes

Remarks

Create a single use app specific incoming SMS request for the calling package.

This method returns a token that if included in a subsequent incoming SMS message, and the SMS message has a prefix from the given prefixes list, the provided intent will be sent with the SMS data to the calling package.

The token is only good for one use within a reasonable amount of time. After an SMS has been received containing the token all subsequent SMS messages with the token will be routed as normal.

An app can only have one request at a time, if the app already has a request pending it will be replaced with a new request.

<p class="note"><strong>Note:</strong> This method 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 operation being completed on the subscription associated with logical slot 0. Use #getSmsManagerForSubscriptionId(int) to ensure the operation is performed on the correct subscription. </p>

Java documentation for android.telephony.SmsManager.createAppSpecificSmsTokenWithPackageInfo(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