Search code examples
javaandroidgoogle-playsocial-networkingreferrals

Android sharing google play install referrer url in social networks?


I have to share the URL of my app in play-store with campaigner details in social networks and when the guest install the app i will use com.android.vending.INSTALL_REFERRER for fetching the campaigner details.my doubt is how i will build the URL and share it programmatically.

Following is what i understand..

1) Create a URL which links play-store with our package name & unique referrer details like this https://play.google.com/store/apps/details?id=com.hellochatty&referrer=tracking_id%3D123456789

2)Share the URL via any social media

3)When click the shared link it will redirect to play-store and while installing the app we can get the referrer param using broadcast receiver.

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

Please let me know if anything wrong in my understandings ?


Solution

  • Everything is correct. You can test your app configuration running this command in the terminal:

    adb shell am broadcast -a com.android.vending.INSTALL_REFERRER 
                           -n your.package.name/path.to.receiver --es referrer
                           --es referrer "EXTRA_STRING_VALUE"
    

    For example if your package name is com.hellochatty and the path of your receiver is com.ex.MyReceiver the test command will be:

    adb shell am broadcast -a com.android.vending.INSTALL_REFERRER 
                           -n "com.hellochatty/com.ex.MyReceiver"
                           --es referrer "tracking_id=123456789"