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

Viewed 2286

Prerequesits:

I've already implemented deep linking and universal linking, everything works great.

Here is what I need:

I'm sharing with you a url that looks like that:

https://play.google.com/store/apps/details?id=com.foo.bar&invite=asdf

You open this link on your Android device, navigate to the Google Play listing. Tapping "Install".

Now, I want the app to do the same thing, like if i would open installed app with this link

myfoobar://?invite=asdf

I also need the same for App Store.

Could you show me how do I format App Store/ Google Play url to achieve this?

2 Answers

What I did in a previous app is to catch custom URIs, start a specific router activity which will redirect to the right URL depending on the caught URI.

Code is note the most important, you need to understand the idea. You can't directly setup a magic logic that will allows you to link a custom URI to a custom URL. What you CAN do, is to make your app react to a specific/custom URI (myfoobar://) that will launch a specific and dedicated activity / view controller that will itself redirect to the URL of your choice.

For instance, on Android side:

<activity
    android:name="com.example.android.RouterActivity"
    android:label="@string/title_gizmos" >
    
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "example://gizmos” -->
        <data android:scheme="myfoobar"
              android:host="whatever" />
    </intent-filter>
</activity>

And then, in your RouterActivity, launch your URL.

More information here

On iOS side, same idea, but instead you need to register your custom URI in your info.plist.

More information here and also here.

I hope it helped you. That is how I did in previous apps and it works like a charm.

Related