SmsRetriever

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

const 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.

const 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.

const 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.

const 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.

const String!
EXTRA_STATUS = "com.google.android.gms.auth.api.phone.EXTRA_STATUS"

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

const 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.

const String!
SMS_RETRIEVED_ACTION = "com.google.android.gms.auth.api.phone.SMS_RETRIEVED"

Intent action when SMS message is retrieved.

Public functions

java-static SmsRetrieverClient!
getClient(activity: Activity!)

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

java-static SmsRetrieverClient!
getClient(context: Context!)

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

Constants

const val EXTRA_CONSENT_INTENT = "com.google.android.gms.auth.api.phone.EXTRA_CONSENT_INTENT": String!

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

EXTRA_SIM_SUBSCRIPTION_ID

const val EXTRA_SIM_SUBSCRIPTION_ID = "com.google.android.gms.auth.api.phone.EXTRA_SIM_SUBSCRIPTION_ID": String!

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

EXTRA_SMS_MESSAGE

const val EXTRA_SMS_MESSAGE = "com.google.android.gms.auth.api.phone.EXTRA_SMS_MESSAGE": String!

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

EXTRA_SMS_ORIGINATING_ADDRESS

const val EXTRA_SMS_ORIGINATING_ADDRESS = "com.google.android.gms.auth.api.phone.EXTRA_SMS_ORIGINATING_ADDRESS": String!

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

EXTRA_STATUS

const val EXTRA_STATUS = "com.google.android.gms.auth.api.phone.EXTRA_STATUS": String!

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

SEND_PERMISSION

const val SEND_PERMISSION = "com.google.android.gms.auth.api.phone.permission.SEND": String!

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

SMS_RETRIEVED_ACTION

const val SMS_RETRIEVED_ACTION = "com.google.android.gms.auth.api.phone.SMS_RETRIEVED": String!

Intent action when SMS message is retrieved.

Public functions

getClient

java-static fun getClient(activity: Activity!): SmsRetrieverClient!

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

getClient

java-static fun getClient(context: Context!): SmsRetrieverClient!

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