Android Deep linking: Use the same link for the app and the play store
This workaround might work:
At the server side, create a redirect rule to google play. For example,
https://www.foo.com/bar/BlahBlah
will redirect tohttps://play.google.com/store/apps/details?id=com.bar.foo&referrer=BlahBlah
.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.
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
How to Resolve "Waiting for Debugger" Message
How to Set Android_Sdk_Home Environment Variable
How to Sign an APK with More Than One Certificate
Android:Get View Reference to a Menu Item
How to Use View.Ontouchlistener Instead of Onclick
Android Type_Linear_Acceleration Sensor - What Does It Show
How to Set Text in an Edittext
System.Exit(0) Doesnt Close All My Activities
Programmatically Obtain the Android API Level of a Device
How to Access Fragment's Child Views Inside Fragment's Parent Activity
How to Send Broadcast from One App to Another App
Differencebetween Activity and Context
How to Change Textcolor in Alertdialog
Buildconfig.Debug Always False When Building Library Projects with Gradle
Android: Autocompletetextview Show Suggestions When No Text Entered
Implementing a Rich Text Editor in Android
Android Open External Storage Directory(Sdcard) for Storing File