如果我发送短信到我的手机,那么短信用户同意API收到短信良好。
短信接收成功结果
如果我通过FirebaseAuth发送短信到我的手机,那么短信成功到达我的设备。
firebase发送的代码
但是当我用Firevase发送SMS并试图用SMS用户同意API捕获它时,我会崩溃
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
我试图在活动开始时运行SMS用户同意API,在Firebase发送SMS之后,在Firebase发送之前,在Firebase发送延迟之后,总是崩溃:(
这就是我如何设置SMS用户同意API短信用户同意API setup1短信用户同意API setup2短信用户同意API setup3
这是我如何设置FirebasePhoneAuthFirebasePhoneAuth setup2
我再重复一遍,分开的话,两者都能很好地工作,但放在一起就会崩溃!
源代码https://github.com/StenleyDuFoster/ExampleFirebasePhoneAuthWithOneTapVerificationApi
它们不能一起工作,因为它们在某些时候为相同的api崩溃并给出错误。唯一的解决方案是要么删除smsretriever,要么更改为不包括firebase的另一个源。