Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency for SMS Retriever API

I am trying to implement SMS Retriever API, but I am unable to find classes like SmsRetrieverClient. I'm not able to import them.

Refer to the following sample code:

 SmsRetrieverClient client = SmsRetriever.getClient(context);
 Task<Void> task = client.startSmsRetriever();
 task.addOnSuccessListener(new OnSuccessListener<Void>() {});

I have added following dependency, after which I am able to refer the classes:

compile 'com.google.android.gms:play-services:11.0.2'
  1. But as this include all service API, I want to know the dependency specific to SMS Retriever API

    I have referred to this doc for all dependency and added following, but it did not work.

    com.google.android.gms:play-services-auth:11.0.2
    com.google.android.gms:play-services-identity:11.0.2
    
  2. Also, is it necessary to have 11.x.x versions?

like image 547
Sasuke Uchiha Avatar asked Jul 03 '17 12:07

Sasuke Uchiha


People also ask

Does Google have an SMS API?

Google Play services has two APIs you can use to streamline the SMS-based verification process: the SMS Retriever API and the SMS User Consent API. The SMS Retriever API provides a fully automated user experience and should be used when possible.

What is the SMS Retriever API?

With the SMS Retriever API, you can perform SMS-based user verification in your Android app automatically, without requiring the user to manually type verification codes, and without requiring any extra app permissions. When you implement automatic SMS verification in your app, the verification flow looks like this:

How to perform SMS-based user verification in your Android app?

With the SMS Retriever API, we can perform SMS-based user verification in our Android app automatically, without requiring the user to manually type verification codes, and without requiring any extra app permissions In this article, we will learn our SMS Retriever API and see how this can be easily used for SMS verification. So, let’s get started.

How to retrieve SMS from phone number in Android?

After obtaining phone number and started SMS retriever, you need to send the user’s phone number to your verification sever using any method. register receiver in AndroidManifest.xml with intent filter com.google.android.gms.auth.api.phone.SMS_RETRIEVED


Video Answer


1 Answers

Try adding the following dependency:

implementation "com.google.android.gms:play-services-auth-api-phone:$playServicesVersion"

replace $playServicesVersion with the play services version you are using.

like image 176
notdrone Avatar answered Oct 21 '22 21:10

notdrone