Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch app if installed, or open Google Play with install referrer

We are trying to generate a link that, when clicked in a browser, opens our App if it's installed. This is usually done with something like this:

intent://some.domain/some=parameters#Intent;scheme=somescheme;package=my.package.name

If configured correctly, this uri can launch your App if it's installed, and redirect you to the play store otherwise. However, this is not what we want. We want to redirect to the play store with an install referrer. As far as we know, the intent:// syntax cannot do this.

Another solution we came up with was to make

market://details?id=my.package.name&referrer=somereferrer

openable with our App. The problem with this method is that it will not automatically launch the App, but rather ask the user whether they'd like to open the link with our App or the Play Store.

Any workaround for this? Even the slightest suggestion would be appreciated.

like image 560
cozyconemotel Avatar asked Mar 30 '15 07:03

cozyconemotel


2 Answers

I'm not sure 100% to have understood your question. I try to reformulate: you want your link to redirect to your app if installed without having the "open with" choice.

One solution, if you are developing for new Android M is to use App Link: here. But again, I'm not sure that is what you want.

like image 129
gbaccetta Avatar answered Oct 21 '22 03:10

gbaccetta


I think this is your answer https://stackoverflow.com/a/28792160/5034920 Basically you must implement the intent filter like this:

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

and 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.

like image 37
Ricardo Santos Avatar answered Oct 21 '22 05:10

Ricardo Santos