SmsRetriever

public final class SmsRetriever


SmsRetriever provides access to Google services that help you retrieve SMS messages sent to your app without having to ask for android.permission.READ_SMS or android.permission.RECEIVE_SMS.

To use SmsRetriever, obtain an instance of SmsRetrieverClient using getClient or getClient, then start the SMS retriever service by calling startSmsRetriever or startSmsUserConsent. The service waits for a matching SMS message until timeout (5 minutes).

Summary

Constants

static final String
EXTRA_CONSENT_INTENT = "com.google.android.gms.auth.api.phone.EXTRA_CONSENT_INTENT"

Intent extra key of the consent intent to be launched from client app.

static final String
EXTRA_SIM_SUBSCRIPTION_ID = "com.google.android.gms.auth.api.phone.EXTRA_SIM_SUBSCRIPTION_ID"

[Optional] Intent extra key of the retrieved Sim card subscription Id if any, as an int.

static final String
EXTRA_SMS_MESSAGE = "com.google.android.gms.auth.api.phone.EXTRA_SMS_MESSAGE"

Intent extra key of the retrieved SMS message as a String.

static final String
EXTRA_SMS_ORIGINATING_ADDRESS = "com.google.android.gms.auth.api.phone.EXTRA_SMS_ORIGINATING_ADDRESS"

Intent extra key of the SMS originating address as a String.

static final String
EXTRA_STATUS = "com.google.android.gms.auth.api.phone.EXTRA_STATUS"

Intent extra key of Status, which indicates SUCCESS or TIMEOUT.

static final String
SEND_PERMISSION = "com.google.android.gms.auth.api.phone.permission.SEND"

Permission that's used to register the receiver to detect that the broadcaster is the SMS Retriever.

static final String
SMS_RETRIEVED_ACTION = "com.google.android.gms.auth.api.phone.SMS_RETRIEVED"

Intent action when SMS message is retrieved.

Public methods

static SmsRetrieverClient
getClient(Activity activity)

Create a new instance of SmsRetrieverClient for use in an Activity.

static SmsRetrieverClient
getClient(Context context)

Create a new instance of SmsRetrieverClient for use in a Context.

Constants

public static final String EXTRA_CONSENT_INTENT = "com.google.android.gms.auth.api.phone.EXTRA_CONSENT_INTENT"

Intent extra key of the consent intent to be launched from client app.

EXTRA_SIM_SUBSCRIPTION_ID

public static final String EXTRA_SIM_SUBSCRIPTION_ID = "com.google.android.gms.auth.api.phone.EXTRA_SIM_SUBSCRIPTION_ID"

[Optional] Intent extra key of the retrieved Sim card subscription Id if any, as an int.

EXTRA_SMS_MESSAGE

public static final String EXTRA_SMS_MESSAGE = "com.google.android.gms.auth.api.phone.EXTRA_SMS_MESSAGE"

Intent extra key of the retrieved SMS message as a String.

EXTRA_SMS_ORIGINATING_ADDRESS

public static final String EXTRA_SMS_ORIGINATING_ADDRESS = "com.google.android.gms.auth.api.phone.EXTRA_SMS_ORIGINATING_ADDRESS"

Intent extra key of the SMS originating address as a String.

EXTRA_STATUS

public static final String EXTRA_STATUS = "com.google.android.gms.auth.api.phone.EXTRA_STATUS"

Intent extra key of Status, which indicates SUCCESS or TIMEOUT.

SEND_PERMISSION

public static final String SEND_PERMISSION = "com.google.android.gms.auth.api.phone.permission.SEND"

Permission that's used to register the receiver to detect that the broadcaster is the SMS Retriever.

SMS_RETRIEVED_ACTION

public static final String SMS_RETRIEVED_ACTION = "com.google.android.gms.auth.api.phone.SMS_RETRIEVED"

Intent action when SMS message is retrieved.

Public methods

getClient

public static SmsRetrieverClient getClient(Activity activity)

Create a new instance of SmsRetrieverClient for use in an Activity.

getClient

public static SmsRetrieverClient getClient(Context context)

Create a new instance of SmsRetrieverClient for use in a Context.