Install Referrer Receivers
AppVirality ensures attribution of devices based on a proprietary device fingerprinting technique that creates a User Key for every business user as a hash of multiple device & user parameters. This notwithstanding, AppVirality uses Google’s INSTALL_REFERRER receiver for attribution as a fallback, in addition to device fingerprinting.
CASES:
Add the following code block if you don’t already have an INSTALL_REFERRER receiver in your manifest.
<receiver android:name="com.appvirality.AppViralityInstallReferrerReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver>
OR
If you already have an INSTALL_REFERRER receiver, use following code block in the onReceive method of the same:
import com.appvirality.AppVirality; ... if (extras != null && extras.containsKey("referrer")) { String referrer = intent.getStringExtra("referrer"); AppVirality.setReferrerKey(context, referrer); }
ELSE
If you have multiple INSTALL_REFERRER receivers in your app, there is strong chance that the receivers would be missed upon app installation.
This happens because Google Play Store is tuned to deliver referrer info to a single receiver only. You may, however, workaround this issue – by putting in place a parent receiver – which would call all the other receivers individually.
Have a ‘Class‘ in your application which resembles (or is exactly) this:
public class ManyInstallReferrerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { new com.appvirality.AppViralityInstallReferrerReceiver().onReceive(context, intent); // Now you can pass the same intent on to other services new com.google.analytics.tracking.android.CampaignTrackingReceiver().onReceive(context, intent); } }
Then, in your AndroidManifest.xml, you can refer to this class instead of AppVirality Install Referrer Receiver:
<receiver android:name="YourPackageName.ManyInstallReferrerReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver>