Dash Stats Docs

ReferrerReceiver

public class ReferrerReceiver extends BroadcastReceiver

This class receives the install string from the Play Store.

If you use the AppBrain AAR library (see: Getting started), it will automatically register the ReferrerReceiver in your AndroidManifest:

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

If you have other receivers that you also want to have notified, you can manually register ReferrerReceiver in your AndroidManifest. You can then specify other receivers using meta-data parameters, like for instance in the following snippet, where both the Analytics and AdMob install receivers are notified of a referrer as well (android:name can be any value as long as it starts with “forward.”):

<receiver android:name="com.appbrain.ReferrerReceiver" android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER"/>
  </intent-filter>
  <meta-data android:name="forward.GoogleAnalytics" android:value="com.google.android.apps.analytics.AnalyticsReceiver"/>
  <meta-data android:name="forward.Admob" android:value="com.google.ads.InstallReceiver"/>
  <meta-data android:name="forward.AnotherOne" android:value="com.myapp.CustomReceiver"/>
</receiver>

Alternatively, if you use your own INSTALL_REFERRER receiver, you can remove the AppBrain ReferrerReceiver by adding the following to your AndroidManifest:

<receiver
    android:name="com.appbrain.ReferrerReceiver"
    tools:node="remove"/>

Note that for this to work you also need to define the “tools” namespace in your root manifest tag:

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    ...
Author:AppBrain

Methods

public void onReceive(Context context, Intent intent)

Receive the referrer String from the Android market.

public static String retrieve(Context context)

Retrieve the saved referrer String from the Android market.

Parameters:
  • context – The current Android Context
Returns:

The referrer String, or null of there was none.