28

I'm developing a social android trivia game. When a user challenges to a game a friend, who doesn't have my trivia game installed, i'd like to send him a custom url to download the app from the market containing a parameter of the inviting user id.

when the app is run for the first time, i need to be able to receive the parameter passed to the market, in order to identify the user and show him the game he was challenged to. i couldn't figure out how to do this with app links and didn't find any appropriate example.

any help would be greatly welcomed! Thanks, Ido

Pratik Butani
  • 51,868
  • 51
  • 228
  • 375
Ido
  • 337
  • 1
  • 3
  • 9

1 Answers1

39

To send data to the Android Market, you have to build an uri like this one:

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

To get this data back, you should implement an INSTALL_REFERRER Receiver.

<receiver android:name="my.package.MyReceiver"
          android:exported="true">
   <intent-filter>
   <action android:name="com.android.vending.INSTALL_REFERRER"></action>
   </intent-filter>
</receiver>

Here is a short tutorial that will explain you how to fully implement this solution.

And if you want to test it without writting any code, checkout my app: Install Referrer on GitHub or on the Play Store

Simon Marquis
  • 6,577
  • 1
  • 23
  • 41
  • thanks for the reply. this is a good alternative solution to app links. I've decided to implement it as I was having problems with app links – Ido Aug 26 '14 at 15:13
  • @user3241315 don't forget to upvote/validate this answer if it was the one you use ;) – Simon Marquis Aug 29 '14 at 08:15
  • thanks:) that is the method i used and it works well. Simon Marquis do you know if its possible to customize the url i pass to the market or i need to use their parameters? – Ido Aug 29 '14 at 22:10