How to get the URI scheme of any app for AppLinks/universal linking?
Asked Answered
N

2

7

I need to open a third-party app from my react native mobile app. I understand that this is called universal linking on iOS and AppLink on Android.

I have done a lot of research for this, and I have been able to set up a link to the third party app on the app store. Now I just need to get my app to open up the app if the user has it installed. That requires the URI scheme of the other app, though.

My question is, how do I get the URI scheme to this third party app? Rather, how do I get the URI scheme of any app? I know the URI scheme of the twitter app is 'twitter://app', but the app I am trying to link to is way more niche than twitter or other popular apps, so there is no help for this sort of thing online.

Any tips?

Nadeau answered 29/5, 2019 at 15:22 Comment(0)
C
11

Finding the URL scheme of an iOS app

Due to Apple's tendency for secrecy, it's not easy to find the URL scheme of an iOS app. But it can be done. Here's how I do it, using a Mac app called iMazing.

  1. Launch iMazing, select a connected iOS device, click Apps:

enter image description here

  1. In the footer of the window, click Manage Apps:

enter image description here

  1. Select the app you're interested in , then select Export .IPA menu item. Note: You may need to download the app first.

enter image description here

  1. The saved file will have the .ipa extension. Change the extension to .zip, and unzip the file. You now have a directory with the name matching the app's name.

  2. Assuming "asana" is the app name, open the file "asana/Payload/asana.app/Info.plist" in a text editor, and search for a section that contains "CFBundleURLSchemes". Assuming the app contains CFBundleURLSchemes (they are optional), it should look something like this:

enter image description here

  1. The URL scheme is in the <string>asana</string>, so the complete url scheme in this case is "asana://". Test that the URL launches the app by typing it into iOS Safari browser window. If it works, Safari should display an alert like this:

enter image description here


What About Apps Without CFBundleURLSchemes?

I haven't found a way to launch apps without CFBundleURLSchemes directly, but you can link to the app's page in the App Store, where the user can open the app with the Open button (or Get button if the app is not installed).

You will need to obtain the app page's URL from the App Store:

  1. Open App Store, go to the app's page, click the share icon:

App Store Asana app page

  1. Click Copy Link:

App Store Copy Link

The URL will look like this:

https://apps.apple.com/us/app/asana-organize-tasks-work/id489969512

Clicking on that link in Safari will bring up the app page in the App Store.

Coroner answered 29/5, 2019 at 20:5 Comment(7)
This is a massive help! I'm going to use this for the iOS version. Will the URI scheme be the same for both iOS and Android?Nadeau
I have no experience with the URL scheme for Android, sorry. But it looks like Android apps store their schemes in a manifest file: developer.android.com/training/app-links/deep-linkingCoroner
I just got the info.plist file, but it doesn't contain CFBundleURLSchemes anywhere in the file.Nadeau
Not all apps contain "CFBundleURLSchemes" definitions, since they are not required. Most of the more popular ones have them. What's the app you are looking at?Coroner
@terrymorde It is the Enphase Enlighten app. play.google.com/store/apps/…Nadeau
That solution is good if the app has defined a URL scheme. But is there any solution for those apps that did not define a URL scheme?Loydloydie
I don't think there's a way to launch an app without a URL scheme directly. But see my edited answer above on how to launch such an app via the App Store.Coroner
A
2

Maybe it is worth to start with some background: There are various ways to deep link into an app, and it depends on the platform (iOS\Android\WindowsPhone...) and its version.

On iOS, up until version 9, the way to open an app was by using URI schemes, e.g. the one you added above: twitter://app. Each app declares the scheme that should be used. Therefore in order to deep link into the app you wish to open, you'll need to use the scheme that it declared. This is the same for Android until version 6.

Starting iOS9+, Apple introduced Universal Links as the method for deep linking. Here's some information: https://developer.apple.com/ios/universal-links/

In these versions, URI schemes won't longer work when using Safari browser (which is the iOS default browser) if the app is not installed. If the app is installed, however, URI schemes should allow opening the app, if everything is configured successfully. In Android there's a similar method called "AppLinks".

Having said this, the above information is for setting deep link for your app. I do not think that it is a common use case to open a third party app from your app - deep links are configured and used by the app owner (e.g. for publishing his\her app to engage users).

Antihero answered 29/5, 2019 at 16:3 Comment(2)
Thanks for they tips! I changed my question to reflect your advice. So I am actually looking for the URI scheme, yes?Nadeau
Well, that's not really a good methodology, as the third party app owner can always change the URI Scheme, or alternatively even stop supporting URI Schemes, and this in turn will break any deep link you are tying to do from your app (or will require you to release a new version of your app). I think the safest way is to redirect the user to the third party app webpage, instead of launching their app from your app. As I mentioned before, deep links are a method for the app owner to engage users into his app.Antihero

© 2022 - 2024 — McMap. All rights reserved.