为什么不接受onReceive接收器?

时间:2015-11-20 12:31:14

标签: android broadcastreceiver

我在Manifest.xml中声明了这样的接收器:

 <receiver android:name=".receivers.MyTrackerReceiver"
        android:exported="true">
        <intent-filter android:priority="998">
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

    <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
    <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
        android:exported="true"
        android:permission="android.permission.INSTALL_PACKAGES">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

我的自定义接收器是

public class MyTrackerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
    Bundle extras = intent.getExtras();
    String referrerString = extras.getString("referrer");
    Log.v("referrer ", referrerString);

    SharedPreferenceUtils.getInstance(context).setReferrer(referrerString);

    new CampaignTrackingReceiver().onReceive(context, intent);
}

}

但是onReceive中的CampaignTrackingReceiver没有被调用,我错过了,谢谢!

1 个答案:

答案 0 :(得分:-2)

现在正在使用向接收器发送广播存在一些问题