Open adiliqbl opened 2 years ago
any update on the fix?
Thank you for the detailed explanation. I was able to reproduce this issue and it seems like it's a bug in Firebase Auth and not in FirebaseUI specifically. I'm transferring this issue to the appropriate repository.
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
While the Auth team investigates this further, there's a current workaround to prevent your app from crashing. You can create a function to check if a browser is available on the device:
private fun isBrowserAvailable(): Boolean {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("http://"))
val info = browserIntent.resolveActivity(requireContext().packageManager)
return info != null
}
And call it right before calling PhoneAuthProvider.verifyPhoneNumber()
:
if (isBrowserAvailable()) {
// Browser is available. Continue with verification
PhoneAuthProvider.verifyPhoneNumber(options)
} else {
// No browser found. Notify the user
Toast.makeText(context, "No browser found to handle verification",
Toast.LENGTH_SHORT).show()
}
If your app targets API Level 30 (Android 11), you'll also need to add a <queries>
entry to your manifest due to the newly introduced package visibility restrictions:
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent>
</queries>
Since this issue was originally opened on the FirebaseUI-Android repo, I'll be sure to update that library to handle these cases.
Hi, we're using Firebase Auth's phone number method for users to signin. We've seen crashes when user doesn't have a browser installed & firebase tries opens captcha link. Crash is always a bad experience for users & since I believe there's nothing we can do here, maybe it would be nice to have exception thrown instead of causing a crash.
Steps to reproduce:
Observed Results:
Expected Results: