SMS verification is very easy and more user friendly than email verification. Now a days where most of app have a registration form, we need to confirm the user information is accurate and user enter valid phone no. In this i explain you how we can create simple sms verification in android application.

Step 1.  Before we start create application we need a standard msg to read a verification from message eg.

Your application VPN is : 12345

Step 2. Now create new android project in your Android Studio/ Eclipse.

Step 3. Open your activity_main.xml file inside res -> layout.

Step 4. Now open your and add this code.

Here in our  i create a method getCode() in this method i query default database of android to read message for specific no. To read about getContentResolver().query() follow this link.

I read message for specific no to get OTP code.

Here i also use handler to check if new message is arrive and read OTP code from the message. This is a simple code to extract OTP from message

Hope this help you some where. Thanku! 🙂