There can be no more than one INSTALL_REFFERER receiver in Android Manifest

I am using the AdMob install receiver in my Android manifest file, for example

<!-- AdMob Install Receiver --> <receiver android:name="com.admob.android.ads.analytics.InstallReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver> 

However, I also want to use my own INSTALL_REFFERER receiver. The problem is that when I turn on my own receiver after AdMob, it is never called. If I turn on the mine in front of the AdMob receiver in the manifest file, mine will be called, but AdMob will not.

Anyway, can I force both calls?

thanks

+4
source share
1 answer

An Android application cannot have multiple receivers that have the same filtering action.

Make the proxy receiver as follows:

in AndroidManifest.xml:

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

in TrackingReceiver.java:

 public class TrackingReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // call AdMob tracker com.google.ads.InstallReceiver ir = new com.google.ads.InstallReceiver(); ir.onReceive(context, intent); // call Analytics tracker com.google.android.apps.analytics.AnalyticsReceiver ar = new com.google.android.apps.analytics.AnalyticsReceiver(); ar.onReceive(context, intent); } } 
+1
source

Source: https://habr.com/ru/post/1341539/


All Articles