Multiple Install Trackers

Referrer details are fetched from Google Play, as `INSTALL_REFERRER` message is no longer supported by Google. You must remove the following lines from yourAndroidManifest.xml:

<receiver
  android:name="com.mixpanel.android.mpmetrics.InstallReferrerReceiver"
  android:exported="true">
  <intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>

You need to use a Google dependency to be able to track your referrer details. Update your build.gradle file with the following dependency:

dependencies {
        implementation 'com.android.installreferrer:installreferrer:1.1'
        ...
}

However, if you want to do your own processing of the install referrer information, or pass the install referrer information on to other third party libraries, you can't just add more receivers to your manifest. This is a known issue with multiple install trackers, but there is a good workaround - you can call all of your trackers individually using your own "parent" tracker. You'll want to include a class like this in your application:

public class ManyInstallTrackersReceiver extends BroadcastReceiver {
  @Override
   public void onReceive(Context context, Intent intent) {
     InstallReferrerReceiver mixpanelReferrerTracking = new InstallReferrerReceiver();
     mixpanelReferrerTracking.onReceive(context, intent);
     // Now you can pass the same intent on to other services,
     // or process it yourself
   }
}

Then, in your AndroidManifest.xml, you can refer to this class instead of Mixpanel:

<receiver
  android:name="my_great_package.ManyInstallTrackersReceiver"
  android:exported="true">
  <intent-filter>
    <action
     android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>
</receiver>
Did this answer your question?

Comments

0 comments

Article is closed for comments.