[solved] canOpenURL issues on Android (both Expo & Standalone)

Hey everyone,

  • SDK 25
  • Nexus 5x (standalone)
  • Genymotion Simulator (Expo)
  • works correctly on iOS (both canOpenURL and openURL)

What I’m trying to accomplish:

  • check if app is installed
  • open app

Despite the app being on the phone, Android will return false. I have tried with this with OTHER apps as well. Android says false.

I’m assuming canOpenURL is the culprit not openURL.

Any help would be appreciated!

Thanks!

Hi @peterpme - we’ll need some more specific information in order to help you with this issue. What URL are you trying to pass into canOpenURL? Could you provide a snack that minimally reproduces this issue?

Hey @esamelson,

Sorry for the delay. Here you go:

Try this on both iOS and Android.

on iOS:

  • canOpenURL returns false despite Gmail being installed (this part is less concerning, I don’t think its a standalone issue)
  • opens Gmail app

on Android:

  • canOpenURL returns false despite Gmail being installed.
  • Does NOT open Gmail app

Ideally, I would like to know (on both iOS and Android) which mail app is installed and display them to the user.

Are the intent URIs different on Android? Is that the issue?

Thanks!!

The reason iOS returns false is because the googlegmail scheme isn’t whitelisted in the Expo client. Some apps used to probe for well-known URL schemes to figure out what you have installed on your phone, which was too much of a privacy issue under Apple’s judgement.

Reading this link: android - Intent URI to launch Gmail App - Stack Overflow – it looks like Gmail on Android doesn’t have a URL scheme.

1 Like

Thanks @ide!

I didn’t realize realize Android had a different flow for opening mail.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.