avasin avasin - 1 month ago 18
Android Question

Is it possible to implement deep links from website to native app nowadays?

I have three buttons on my website, that link to facebook, twitter & vk.com pages. I want to open native app, if it is installed on user device. Otherwise, i want url fallback to be opened.

First of all, i tried to use native app schemes directly with deep-link.js plugin. But, when i tried to open native app url scheme, when native app was not installed, Safari has shown an error, but opened url fallback page finally. Default android browser said that he does not know how to handle such url scheme:

<a class="btn btn-primary" href="https://www.facebook.com/warpcompany" data-app-ios="fb://profile/838619192839881" data-app-android="fb://page/838619192839881">Facebook</a>


Then i tried to use App Links "standard", that that has so much promotion from facebook. I even tried to use their hosted app links, to make sure i've generated everything right way. It does not work, it always redirect to website fallback. You can easily test it by yourself: https://fb.me/746134728830806

So, is it possible to provide deep link on website, that will open native app without errors at least in default os browsers, or fallback silently to url?

Honestly, i'm trying to solve this for several days and have no working result / examples. Perhaps you could provide at least working example/website.

Thanks in advance.

Answer

It is still possible, but on newer versions of the Android default browser you have to use intents instead of just trying to open the deep link. For example replace your fb://page/838619192839881 with

intent://page/838619192839881#Intent;scheme=fb;package=com.facebook.katana;end

This will fallback to Google play by default, but you can override the fallback adding a S.browser_fallback_url:

intent://page/838619192839881#Intent;scheme=fb;package=com.facebook.katana;S.browser_fallback_url=http%3A%2F%2Fwww.facebook.com%2F;end

The fallback should be url encoded.

Of course you'll have issues if the user is not on an Android phone or with an old version of the default browser (or strange browser). You can setup a bunch of conditions and replace your HTML with the correct code for each case.

I work on HOKO, which is a free, simple and easy way to have everything working on Android and iPhone and we've done all the dirty work around this. You can rather use it or just drop us a line and we'll help you out.

Comments