android.content.ActivityNotFoundException: No Activity found to handle Intent

We’re getting quite a few exceptions on the Android side with react-native-auth0 library. I believe that the main cause is that we need to handle a case when the Browser app is not available on a specific Android device. So the solution would be to wrap this into the try-catch block and propagate the error to ReactNative and ask the user to download the Browser on the library consumer side. Another option is to check in advance if the browser is available https://developers.google.com/web/android/custom-tabs/implementation-guide#what_happens_if_the_user_doesn’t_have_a_browser_that_supports_custom_tabs_installed

Stacktrace:

  • android.app.Instrumentation.checkStartActivityResult Instrumentation.java:2014

  • android.app.Instrumentation.execStartActivity Instrumentation.java:1675

  • android.app.Activity.startActivityForResult Activity.java:4601

  • androidx.fragment.app.FragmentActivity.startActivityForResult FragmentActivity.java:6

  • android.app.Activity.startActivityForResult Activity.java:4559

  • androidx.fragment.app.FragmentActivity.startActivityForResult FragmentActivity.java:3

  • android.app.Activity.startActivity Activity.java:4920

  • androidx.core.content.ContextCompat.startActivity ContextCompat.java:2

  • androidx.browser.customtabs.CustomTabsIntent.launchUrl CustomTabsIntent.java:2

  • com.auth0.react.A0Auth0Module.showUrl A0Auth0Module.java:5

I can create a PR for this to speed things up as this is causes a lot of issues for us.

Unfortunately, I couldn’t create an issue on GitHub as it redirects here.