Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.15 KB

multiple-receivers.md

File metadata and controls

30 lines (25 loc) · 1.15 KB

Support for multiple broadcast receivers

If multiple sources need to register a broadcast receiver for the INSTALL_REFERRER intent in your app, you will have to implement your own
BroadcastReceiver, which calls all the other receivers you want to support. If you have your own broadcast receiver defined in your manifest file (similar to the one stated below):

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

please make sure to inform the AdTrace broadcast receiver (and any other that might need the information) of your intent content like so:

public class InstallReceiver extends BroadcastReceiver {  
	@Override 
	public void onReceive(Context context, Intent intent) {
	 // AdTrace receiver. 
	 new AdTraceReferrerReceiver().onReceive(context, intent); 
	 // Google Analytics receiver. 
	 new CampaignTrackingReceiver().onReceive(context, intent); // And any other receiver which needs the intent. 
	 }
}