How to verify a number similar to WhatsApp?

818 views Asked by At

I know this question has been asked before, however, what has not been answered yet is, an sms is sent to your cellphone and WhatsApp automatically reads the token/authentication code from the sms, without requiring the user to enter the authentication code, then WhatsApp automatically enters the authentication code in the EditText area and then the installation of the App starts automatically.

Similarly, how can my App automatically read the authentication code from the message and enters this authentication code in the EditText area automatically followed by the installation of the App automatically. Any help or guidance regarding this would be highly appreciated.

2

There are 2 answers

1
Dhrumil Shah - dhuma1981 On BEST ANSWER

WhatsApp reads your inbox and finds the message sent from it only, After that Whatsapp fetches the authentication code and display it to the view.

To implement such feature you need to write a Broadcast received which get the details when any SMS received and then you can filter that message to fetch your authentication code.

Refer this article. http://androidexample.com/Incomming_SMS_Broadcast_Receiver_-_Android_Example/index.php?view=article_discription&aid=62&aaid=87

1
null pointer On

set a Broadcast receiver to get a call when the SMS is received

 <intent-filter>
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
 </intent-filter>

Then read the message for the code.