The main entry point for interacting with SmsRetriever.
This does not require a GoogleApiClient.
See GoogleApi
for more information.
| abstract Task<Void> |
startSmsRetriever()
Starts
SmsRetriever, which waits for a matching SMS message until
timeout (5 minutes).
|
| abstract Task<Void> |
startSmsUserConsent(String
senderAddress)
Starts
SmsUserConsent, which waits for an OTP-containing SMS
message until timeout (5 minutes).
|
Starts SmsRetriever, which waits for a matching SMS message until
timeout (5 minutes). The matching 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 retrieved SMS message as a
String, and
SmsRetriever.EXTRA_STATUS for Status to
indicate SUCCESS, DEVELOPER_ERROR, ERROR, or TIMEOUT.
Note: Add
SmsRetriever.SEND_PERMISSION in
Context.registerReceiver(BroadcastReceiver, IntentFilter, String, Handler)
while registering the receiver to detect that the broadcast intent is from the SMS
Retriever. Be aware that this detection only works on devices using Google Play
services v19.8.31 and later.
The possible causes for errors are:
Task for the
call. Attach an OnCompleteListener
and then check Task.isSuccessful()
to determine if it was successful.Starts SmsUserConsent, which waits for an OTP-containing SMS message
until timeout (5 minutes). OTP-containing SMS message can be retrieved with two
steps.
Note: Add
SmsRetriever.SEND_PERMISSION in
Context.registerReceiver(BroadcastReceiver, IntentFilter, String, Handler)
while registering the receiver to detect that the broadcast intent is from the SMS
Retriever. Be aware that this detection only works on devices using Google Play
services v19.8.31 and later.
SmsRetriever.SMS_RETRIEVED_ACTION. The Intent contains Extras with keys
SmsRetriever.EXTRA_CONSENT_INTENT for the consent Intent and
SmsRetriever.EXTRA_STATUS for Status
to indicate SUCCESS or TIMEOUT.startActivityForResult
with consent Intent to launch a consent dialog to get user's approval, then the
OTP-containing SMS message can be retrieved from the activity result.| senderAddress | address of desired SMS sender, or null to retrieve any sender |
|---|
Task for the
call. Attach an OnCompleteListener
and then check Task.isSuccessful()
to determine if it was successful.