3

I had tested the Appbrain SDK and Inmobi SDK. And I found this common receiver. And I made custom receiver. I thought that when download the app in google market, google market sends 'referer' value to my app. But I haven't received anything. What's problem?

//This is Appbrain's receiver
<receiver android:exported="true" android:name="com.appbrain.ReferrerReceiver" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>


//This is Inmobi's receiver
<receiver android:name="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever" android:exported="true"  >
   <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
      <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
   </intent-filter>
</receiver>


//This is My Custom receiver
<receiver android:name="com.xgame.adproject2.TestReceiver" android:exported="true" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

// source
public class TestReceiver extends BroadcastReceiver{

    public static final String TAG = "TEST";

    String referrerString = "";

    @Override
    public final void onReceive(Context context, Intent intent) {

        Log.e(TAG, "11111111");

        if(intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
           Bundle extras = intent.getExtras();
           referrerString = extras.getString("referrer");

           Log.e(TAG, "REFERRER: " + referrerString);
        }
    }
}

When down the app, I was input this url in android web browser. But after download app, I haven't received referrer value.

https://play.google.com/store/apps/details?id=com.xgame.adproject2&referrer=utm_source%3Dcom.xgame.adproject2%26utm_medium%3Dgoogle%26utm_term%3Dbanner%26utm_campaign%3Dxgame

netcleaner
  • 33
  • 1
  • 1
  • 5

2 Answers2

4

One important thing to note is that the Android market / Google Play will only send the install referrer to the first receiver you define in your manifest. So in this case only the AppLift receiver will get it.

There is a way to "forward" the event from the AppLift receiver as described in the JavaDoc: http://swisscodemonkeys.github.com/appbrain-sdk/javadoc/reference/com/appbrain/ReferrerReceiver.html

In your case, your manifest should look like this:

//This is Appbrain's receiver
<receiver android:exported="true" android:name="com.appbrain.ReferrerReceiver" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
    <meta-data android:name="forward.inmobi" android:value="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever" /> 
    <meta-data android:name="forward.custom" android:value="com.xgame.adproject2.TestReceiver" />
</receiver>

// Keep the execution of InMobi on connectivity change
<receiver android:name="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever" android:exported="true" >
   <intent-filter>
      <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
   </intent-filter>
</receiver>

Note that a related bug on the Android issue tracker that might be worth starring is this: http://code.google.com/p/android/issues/detail?id=24119 (it's about bringing back referrer strings from organic app discovery, and if they fix that hopefully they will also add the referrer string when an install comes through the Play website).

3

A long time ago the Android market would pass you a referrer string of the market page that led to your install. At some point Google stopped this. You can see a thread on this at http://productforums.google.com/forum/#!topic/android-market/F5TO9uE3WSA

Now you get the referrer string only if you explicitly pass is to the market app when opening it. For example if app A has a button to install app B, you can pass a referrer string market://details?id=B&referrer=A. It's useful mostly for ad network that want to measure the effectivity of ads for apps

yoah
  • 7,030
  • 2
  • 25
  • 30
  • thank you for your explain. I was request with this uri. 'market://details?id=com.xgame.adproject2&referrer=utm_source%3Dgoogle%26utm_medium%3Dgoogle%26utm_term%3Dbanner%26utm_campaign%3Dxgame' And succeeded. – netcleaner Oct 03 '12 at 07:13