Get referrer after installing app from Android Market Get referrer after installing app from Android Market android android

Get referrer after installing app from Android Market


I would try to help who, like me, fails to make install_referrer work and who don't find ANY useful information about these features.

Notes:

  1. The intent com.android.vending.INSTALL_REFERRER will be caughtduring the install process, not when the application starts for thefirst time.
  2. The referrer ...extras.getString("referrer").. is fixed but the contents can be any string value that respect the http get syntax ...referrer=thatsthevalue&thisisnot=xxx

The above code is okay, just some explanations to complete the info:

  1. Android Manifest. The <receiver> tags must be inside the<application> tags.
  2. The correct url to link the market is not the results of the famous google forms in sdk

but this one

http://market.android.com/details?id=your.application.package.name&referrer=my_referrer_finally_works_fine

Obviously, you need to follow the link from the mobile device and the only way for a complete test is to publish a test application in the market.

And a final and personal note.

I don't understand why those info are omitted completely and i hope that Google will act for detailing it.


This might be a little late, but you CAN test the install referrer without using Google Play, just use ADB :)

Run this from adb.exe

adb shellam broadcast -a com.android.vending.INSTALL_REFERRER -n your.package/path.to.your.BroadcastReceiver --es "referrer" "test_referrer=test"

If you have logging setup in your BroadcastReceiver, you will see it popup in LogCat.

Hope this helps!


I think these answers must have been written pre-Android 3.1 - because things have changed in one import way.

The system now marks app as dormant when they are installed - they won't receive INSTALL_REFERRER or any other broadcast until the user explicitly activates the app by running it (or placing widget).