Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 1.32 KB

referrer.md

File metadata and controls

41 lines (34 loc) · 1.32 KB

Support multiple broadcast receivers

If multiple SDKs need to register a broadcast receiver for the INSTALL_REFERRER intent in your app, you will have to implement your own BroadcastReceiver that calls all the other receivers that you want to support. It should look like this [1]:

public class InstallReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        // Adjust
        new ReferrerReceiver().onReceive(context, intent);

        // Google Analytics
        new CampaignTrackingReceiver().onReceive(context, intent);
    }
}

Make sure to adjust the list of supported receviers and fix the imports. You also need to update your AndroidManifest.xml to use your own InstallReceiver:

<receiver
    android:name="com.your.app.InstallReceiver"
    android:exported="true" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

Make sure to adjust your package name.


References and related links: