Android Question How To Avoid Application Crash in Sms Verification

khwarizmi

Active Member
Licensed User
Longtime User
Hello All

I am using Firebase phone number authentication according to this tutorial, the problem is that if the phone number entered by the user is in another device, or if the authentication is not done automatically, and the user has typed the authentication code incorrectly, the application will crash and stop working. How do I avoid that?

B4X:
authphone.verifyPhoneNumberWithCode( gs_verificationID, ls_code)

Try and Catch does not solve the problem

the error:
** Activity (registration) Pause, UserClosed = true **
** Activity (smsverification) Create, isFirst = true **
** Activity (smsverification) Resume **
default sign in: com.google.firebase.auth.internal.zzp@1157e43
onCodeSent: AOO2nWU3O4ItjIZzC2RzeFTOkax_8rg5zdclJcd1esUzckwrePOBV6Wq5797Lev5XoFg5vocItmSX4D2hRhyvNEK1znAj3nRJ2V8kExecojZuXWwWRqyOpNAp70UzDPgLWS8edXTmRJusaeaDotAEZKzAW16WoxKVtcnMsTVMTuCWUuJuzjKzMKt4jhsNptcDNaR7bl_d5t8bZG5-h51TGhvInmskEx-waFXiFqF8hoyjpl5jY9ws4Q_-BHKSRlU2jLlsfOjaXNX1yOZ6dpapBMYVndpvV-JYg
authphone_oncodesent successtrue
signInWithPhoneAuthCredential _phonesignedin: false
com.google.android.gms.tasks.RuntimeExecutionException: com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The sms verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.
at com.google.android.gms.tasks.zzw.getResult(com.google.android.gmslay-services-tasks@@17.2.1:3)
at anywheresoftware.b4a.FirebaseAuthPhone.FirebaseAuthPhoneWrapper$4.onComplete(FirebaseAuthPhoneWrapper.java:401)
at com.google.android.gms.tasks.zzi.run(com.google.android.gmslay-services-tasks@@17.2.1:1)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7406)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The sms verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.
at com.google.firebase.auth.api.internal.zzej.zza(com.google.firebase:firebase-auth@@19.4.0:30)
at com.google.firebase.auth.api.internal.zzfm.zza(com.google.firebase:firebase-auth@@19.4.0:21)
at com.google.firebase.auth.api.internal.zzff.zza(com.google.firebase:firebase-auth@@19.4.0:33)
at com.google.firebase.auth.api.internal.zzfh.zza(com.google.firebase:firebase-auth@@19.4.0:74)
at com.google.firebase.auth.api.internal.zzep.zza(com.google.firebase:firebase-auth@@19.4.0:18)
at com.google.android.gms.internal.firebase_auth.zza.onTransact(com.google.firebase:firebase-auth@@19.4.0:13)
at android.os.Binder.execTransact(Binder.java:453)

 

DonManfred

Expert
Licensed User
Longtime User
You already said it is solved in the other thread

Did you updated some artefacts with the SDK-Manager?
 
Last edited:
Upvote 0

khwarizmi

Active Member
Licensed User
Longtime User
I haven't update any artefacts with the SDK-Manager.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…