SMS retrieval API in android

Updated 29 July 2022


In this blog, we going to discuss the SMS retrieval API in android.

SMS retrieval API is used for SMS-based verification without writing the verification code manually.

When we integrate the mobile verification feature in our application and we want to do the verification using the OTP received on our mobile without entering the OTP then this blog is for you.

The above mention verification will work on the below sequence:

Initial setup

Add the Gradle dependency to your app/module build.gradle file like below:

Start SMS retriever

Start the SMS retriever by the SMSRetriever client like below:

Get verification message

Our MySmsListener class is extending the BroadcastReceiver and inside the onReceive we are receiving the SMS contents.

Register the above broadcast receiver with intent filter inside the manifest like below:

Also we have created MessageListener for sending the message data to our activity like below:

As we are using the messageListener interface to pass data to our activity you need to extend the interface like below:

Once we have extended the interface now override the messageReceived() like below:

When the data is received update your view accordingly. Also, pass the data to the server for verification.

Once the server receive the mobile number for verification the verification message for the mobile number must have the below format:

Get SMS retrieval hash

For generating the above mentioned hash code(w34CwYs+zyo) for your application so that the play services will determine that the received message is for your app follow the link.


In this blog, we have learned about the implementation of the SMS retrieval API in android.

For more information regarding the SMS retrieval API in android follow the link.

Thanks for reading this blog. You can also check other blogs from here.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home