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(Context)
or
getClient(Activity)
, then start the SMS retriever service by calling
startSmsRetriever()
or
startSmsUserConsent(String)
. The service waits for a matching SMS message until
timeout (5 minutes).
Constant Summary
String | EXTRA_CONSENT_INTENT | Intent extra key of the consent intent to be launched from client app. |
String | EXTRA_SIM_SUBSCRIPTION_ID | [Optional] Intent extra key of the retrieved Sim
card subscription Id if any, as an int . |
String | EXTRA_SMS_MESSAGE | Intent extra key of the retrieved SMS message as
a String . |
String | EXTRA_STATUS | Intent extra key of Status ,
which indicates SUCCESS or TIMEOUT. |
String | SEND_PERMISSION | Permission that's used to register the receiver to detect that the broadcaster is the SMS Retriever. |
String | SMS_RETRIEVED_ACTION | Intent action when SMS message is retrieved. |
Public Method Summary
static SmsRetrieverClient | |
static SmsRetrieverClient |
Inherited Method Summary
Constants
public static final String EXTRA_CONSENT_INTENT
Intent extra key of the consent intent to be launched from client app.
public static final String EXTRA_SIM_SUBSCRIPTION_ID
[Optional] Intent extra key of the retrieved Sim card subscription Id if any, as an
int
.
public static final String EXTRA_SMS_MESSAGE
Intent extra key of the retrieved SMS message as a String
.
public static final String EXTRA_STATUS
Intent extra key of Status
,
which indicates SUCCESS or TIMEOUT.
public static final String SEND_PERMISSION
Permission that's used to register the receiver to detect that the broadcaster is the SMS Retriever.
public static final String SMS_RETRIEVED_ACTION
Intent action when SMS message is retrieved.
Public Methods
public static SmsRetrieverClient getClient (Activity activity)
Create a new instance of SmsRetrieverClient
for use in an Activity
.
public static SmsRetrieverClient getClient (Context context)
Create a new instance of SmsRetrieverClient
for use in an Context
.