java.lang.Object | |
↳ | com.google.android.gms.auth.api.phone.SmsRetriever |
The SmsRetriever API provides access to Google services that help you retrieve the SMS message directed to your app without asking for android.permission.READ_SMS.
To use SmsRetriever, obtain an instance of SmsRetrieverClient
using getClient(Context)
or getClient(Activity)
, and start SMS retriever service by calling
startSmsRetriever()
. The service waits for ONE matching SMS message
until timeout (5 minutes).
The received SMS message will be sent via a Broadcast Intent with action SmsRetriever.SMS_RETRIEVED_ACTION
. The Intent contains Extras with keys SmsRetriever.EXTRA_SMS_MESSAGE
for the SMS message string and SmsRetriever.EXTRA_STATUS
for the Status to indicate SUCCESS, DEVELOPER_ERROR, ERROR, or TIMEOUT.
The possible causes for errors are:
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | EXTRA_SMS_MESSAGE | Intent extra key of SMS message | |||||||||
String | EXTRA_STATUS | Intent extra key of Status, which indicates SUCCESS or TIMEOUT | |||||||||
String | SMS_RETRIEVED_ACTION | Intent action when SMS message is retrieved. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new instance of
SmsRetrieverClient for use in an Activity . | |||||||||||
Create a new instance of
SmsRetrieverClient for use in an Context . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Intent extra key of SMS message
Intent extra key of Status, which indicates SUCCESS or TIMEOUT
Intent action when SMS message is retrieved.
Create a new instance of SmsRetrieverClient
for use in an Activity
.
Parameters | |
---|---|
activity |
Activity
|
Returns | |
---|---|
SmsRetrieverClient |
Create a new instance of SmsRetrieverClient
for use in an Context
.
Parameters | |
---|---|
context |
Context
|
Returns | |
---|---|
SmsRetrieverClient |