FirebasePhoneAuth crash when i use SMS User Consent API

Viewed 215

If I send SMS to my phone, then SMS User Consent API received sms good.

SMS receive success resualt

If I send SMS to my phone by FirebaseAuth, then SMS success come to my device.

firebase sended code

BUT when I send SMS with Firevase and try to catch it with SMS User Consent API, then i get crash

02-05 08:47:05.119  packege 26223   -   E   AndroidRuntime   FATAL EXCEPTION: main  
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime   Process: packege   , PID: 26223    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime   java.lang.RuntimeException: Error receiving broadcast Intent { act=com.google.android.gms.auth.api.phone.SMS_RETRIEVED flg=0x200010 pkg=packege     (has extras) } in com.google.firebase.auth.api.internal.zzgn@19feaf8   
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1656)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.os.Handler.handleCallback(Handler.java:883)  
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.os.Handler.dispatchMessage(Handler.java:100) 
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.os.Looper.loop(Looper.java:237)  
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.app.ActivityThread.main(ActivityThread.java:8016)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at java.lang.reflect.Method.invoke(Native Method)   
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime   Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int java.lang.CharSequence.length()' on a null object reference 
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at java.util.regex.Matcher.reset(Matcher.java:280)  
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at java.util.regex.Matcher.<init>(Matcher.java:186) 
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at java.util.regex.Pattern.matcher(Pattern.java:1034)   
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at com.google.firebase.auth.api.internal.zzgj.zzc(com.google.firebase:firebase-auth@@20.0.0:112)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at com.google.firebase.auth.api.internal.zzgn.onReceive(com.google.firebase:firebase-auth@@20.0.0:13)   
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1646)    
02-05 08:47:05.119  packege     26223   -   E   AndroidRuntime      ... 8 more  

I tried to run SMS User Consent API at the start of the Activity, after Firebase sending SMS, before Firebase sending, after Firebase sending with a delay and always got a crash :(

this is how i set up SMS User Consent API SMS User Consent API setup1 SMS User Consent API setup2 SMS User Consent API setup3

this is how i set up FirebasePhoneAuth FirebasePhoneAuth setup1 FirebasePhoneAuth setup2

Once again, I repeat that separately, both work well, but together they crash!

source code https://github.com/StenleyDuFoster/ExampleFirebasePhoneAuthWithOneTapVerificationApi

1 Answers

Together they can't work because both crashes for the same api at some point and giving error.The only solution is that either remove smsretriever or change to another source excluding firebase.

Related