Android Firebase Phone Auth Not Receiving SMS Second Time


Answer :

In my case, I have my number on

Phone numbers for testing (optional)

Removing it from there, firebase started sending SMS Code to my number. Spark Plan offer 10k phone auth per month. So that you can test and deploy your app without paying a penny.


In case someone is not getting the concept or reason of not sent sms again then please go through on my below details. I have been confused for very long time that why I didn't get sms for second time, third and so on..

First Read the original documentation:

onVerificationCompleted(PhoneAuthCredential)

This method is called in two situations:

  • Instant verification: in some cases the phone number can be instantly verified without needing to send or enter a verification code.
  • Auto-retrieval: on some devices, Google Play services can automatically detect the incoming verification SMS and perform verification without user action. (This capability might be unavailable with some carriers.)

What I found:

onVerificationCompleted:

is only called when instant verification or auto-retrieval occurs.

When you try this for the first time you will get the otp code from Google but the next time you try it, it can cause instant verification to get active.

You can do:

So if you are debugging and having problem with not receiving otp code from google just disable your sim card and enable it again. This will help you in getting the otp codes from google again for one more time until you enter your code and instant verification gets activated again

Please note:

I don't think there is any way you can disable instant verification as of now. But you can always optimize your code in a way it doesn't create any problem for you and your users.

If you want to explore more then please check the thread: Click here


You must clear data for this app from phone. If not then run remove app and restart your phone will clear all data related with this app and re-run it.


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable