Multiple install receivers in Android

Have you tried having multiple INSTALL_RECEIVERs in your app. For example if you want to integrate and google analytics, they both have install receivers, so if you register the both receivers in the AndroidManifest the OS will pick one of them to send the data to it. So to send the event to all receivers you have to create your custom one and register it in the manifest like:


public class InstallReceiver extends BroadcastReceiver {
    public void onReceive(Context context, Intent intent) {
        InstallListener listener = new InstallListener();
        listener.onReceive(context, intent);

        GoogleAnalyticsReceiver receiver = new GoogleAnalyticsReceiver();
        receiver.onReceive(context, intent);

So all you have to do is instantiate both the receivers in your custom one. This is the way to have multiple receivers. Hope this helps!

You may also like...