Android – CampaignTrackingReceiver is not registered – Google Analytics v4

androidgoogle-analytics

I am using Google analytics v4 in my android app. The install tracking was working fine for some days and all of a sudden my broadcast receiver is not registered.

Logcat says : CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions.

This is what I have done within my Manifest application tag:

    <service android:name="com.google.android.gms.analytics.CampaignTrackingService"
        android:enabled="true"
     android:exported="false" />
    <receiver
        android:name="my.package.CustomCampaignTrackingReceiver"
        android:exported="true" >
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

And my custom campaign tracking receiver looks like this:

public class CustomCampaignTrackingReceiver extends BroadcastReceiver {

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

    // When you're done, pass the intent to the Google Analytics receiver.
        new CampaignTrackingReceiver().onReceive(context, intent);

        Log.v("ReferralReceiver", " " + intent.getAction());
        Log.v("ReferralReceiver", " " + intent.getDataString());
        Log.v("ReferralReceiver", " " + intent.toString());
        Log.v("ReferralReceiver", " " + intent.getStringExtra("referrer"));

        //call to other referrers

  }
}

I am not able to figure out where things are going out of hand. I am using only one INSTALL_REFERRER filter in my manifest.

Best Solution

I guess you didn't implemented AnalyticsService and AnalyticsReceiver? This is what I did to make it work

    <!-- Google Analytics --> 
    <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
              android:enabled="true"
              android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>
    <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
    <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
              android:enabled="true">
        <intent-filter>
            <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
        </intent-filter>
    </receiver>
    <service android:name="com.google.android.gms.analytics.AnalyticsService"
             android:enabled="true"
             android:exported="false"/>
Related Question