AppsFlyer integration test fails

2.1k views Asked by At

I am using AppsFlyer for install and uninstall tracking. I have gone through the documents and integrated it. I used their Interation test app for integration verification.

as per the document it is required to use MultipleInstallBroadcastReceiver If we already have a receiver listening on the INSTALL_REFERRER. I am already using

  <receiver
   android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>

hence as per documents i have used following as FIRST receiver (means it is written before the CampaignTrackingReceiver one)

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

but their integration test shows error. if i use SingleInstallBroadcastReceiver instead of MultipleInstallBroadcastReceiver than integration test app display successful integration.

can somebody help me in this case

1

There are 1 answers

1
shachar0n On BEST ANSWER

Basically the SingleInstallBroadcastReceiver is meant to be used when you have another receiver which is 'supportive' of other existing receivers of the same intent filter (eg. will catch the intent and then re-broadcast it for other possible receivers that may listen on the same intent filter). This is since the the SingleInstallBroadcastReceiver is not as such.

The MultipleInstallBroadcastReceiver, on the other hand, is considered 'supportive' of other same-intent-filter receivers (not sure if that's the correct term), and if combined with another 'supportive' receiver, it may cause infinite broadcasting of the intent between the receivers. This is why you have these two kind of receivers.

However, here's how you can achieve the same by using declaring one receiver (and have more control over the process):

Implement your own BroadcastReceiver and call the onReceive(context, intent) of whatever receiver you need:

public class MyCombinedReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        // Google Analytics receiver
        new CampaignTrackingReceiver().onReceive(context, intent);

        // AppsFlyer SingleInstallBroadcastReceiver
        new SingleInstallBroadcastReceiver().onReceive(context, intent);
    }
}

On your AndroidManifest.xml declare your receiver that you configured above, and make sure this is the only receiver you have on your manifest with that intent-filter (if you have others, just call them on your receiver's onReceive method):

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