简体   繁体   中英

How install_referrer works

i am trying to use install_referrer and have a question, my app only "catches" the referrer broadcast when its open or in the memory. but when you install an app from tha play store its not getting open nor on the memory, so how can i make my app catch the broadcast on installation if its not running on the backround? thats my code:

public class SDK_Referrer extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
    Log.d(TAG, "entered onRecive");
    if (intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
        String referrer = intent.getStringExtra("referrer");

Thanks!

You need to add the receiver to your manifest, so your app knows you have something listening for the broadcast. Something like this:

<receiver android:name="com.company.cool.SDK_Referrer" android:exported="true">
    <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
  </receiver>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM