Android Deep Linking: Use the Same Link for the App and the Play Store

Android Deep linking: Use the same link for the app and the play store

This workaround might work:

  1. At the server side, create a redirect rule to google play. For example, https://www.foo.com/bar/BlahBlah will redirect to https://play.google.com/store/apps/details?id=com.bar.foo&referrer=BlahBlah.

  2. At the app, register the server side link as a deep link:

<data android:scheme="https"
android:host="www.foo.com"
android:pathPrefix="/bar" />

Now, if the app is installed, the URL will be caught and the path can be parsed to extract the BlahBlah part. If the app isn't installed pressing the link will redirect the user to the Play store with the referring URL.

enter image description here

Notes:

  • /bar/BlahBlah was converted to &referrer=BlahBlah, because the play store receives a URL argument and the deep link mechanism works with URL paths (as far a I can tell)

Having a deeplink automatically direct to the Google Play Store or Apple App store depending on the device type

Our devs are insisting that using a single link is impossible

I think your devs are trying to avoid work :P

https://firebase.google.com/docs/dynamic-links

Url format for App Store and Google Play to install app with deep link

I think this should fulfill your needs: https://firebase.google.com/docs/dynamic-links.
It also goes further and honors the initial deep link after the app is installed.

How to open my app with deep linking instead of google play store site?

So, this was tricky for me.
Just add this:

<intent-filter android:label="@string/filter_title_view_app_from_web">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="my.site.name"
android:scheme="http" />
</intent-filter>

And use this button as a link:

<a href="intent://my.site.name#Intent;scheme=http;package=my.package.name;end">  
<img alt="Get it on Google Play" src="images/download_from_google_play_image.png">
</a>

And if the app has already been installed, then the app will be opened. Otherwise, Google Play Market app will be opened (that was a surprise for me...).



Related Topics



Leave a reply



Submit