Search code examples
androidiosios9url-schemeios-universal-links

iOS custom URL schemes vs. Universal Links and Android counterpart


I'm looking for functionality where when a user receives a message - let's say through the WhatsApp app - containing a link starting with a certain scheme (prefix), my app will be invoked when the user taps on that link.

I understand that this feature is already available as "custom URL schemes" but I also noticed now that Universal Links have a similar thing. So, is there any issue with "custom URL schemes"? I don't want to use Universal Links because I don't want my app to be restricted to iOS 9.

Moreover, it looks like Android also has this feature of customer URL, but again, on the latest Android version 6.0, it's mentioned here that they also have "App Links" feature which only works on Android 6.0. So, again, what is the difference between the two?

I don't want to restrict my app to work on only iOS9 or Android 9. So I guess the traditional "custom URL schemes" is more attractive for me for the time being.

Also, I want to make sure that "custom URL schemes" will work when a user taps on a link on WhatsApp or it will only work if the link on the web browser or mail.


Solution

  • URLs with custom schemes don't get displayed as links in many Android applications (SMS, E-Mail, WhatsApp, Hangouts, you name it), which de facto make them unopenable by your application. iOS however does not allow for defining scheme + host + path like android does.

    One possible (hacky) solution to this is browser sniffing (I know, evil, but so are non-standard extensions to well-defined behavior, especially if nothing was broken in the first place) at the resource you expose over a URL reachable over HTTP(s).

    You could check if the request origins from the iOS-platform you offer native apps for; then you would have to make sure that the device has your application installed (this is getting uglier and uglier; see here for example) and then, only then redirect to yourapp://the-rest-of-your/uri, which causes a prompt shown to the user whether they want to open the address inside the application or not. (Tested on an iPhone 4 with iOS 8, Safari browser.)