I have customized deep linking, it is working fine for users having the app. But for users not having the app, it doesn't redirect them to playstore.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="abc.in"
android:pathPrefix="/abc"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
MY Code for generating deeplink
public void Share() {
firebaseAnalyticsUtil.fireEvent("shared_link");
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_SUBJECT,"Hey!");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Share Text - "+"http://abc.in/abc/"+ID);
startActivity(Intent.createChooser(sharingIntent,"Share using"));
}
Assist me to redirect user to playstore, if user does not have the app
You are using App Links, which means these are regular http://
links. When your user clicks http://abc.in/abc
, one of two things will happen:
http://abc.in/abc
in their web browser.It's case 2 you're trying to handle, and the approach is simple: redirect your visitor to the Play Store using the page at http://abc.in/abc
. This can be done via Javascript or HTTP (a 307 redirect is the most common).
However, note that this alone is not enough for a complete deep linking solution. You also need to support...
I suggest looking into hosted deep link services like Branch.io (full disclosure: I'm on the Branch team) or Firebase Dynamic Links. They will make your life a lot easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With