我正在尝试在我的Android应用程序上测试播放商店跟踪参数。
我已使用以下代码更新了清单文件
<!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background
dispatching on non-Google Play devices -->
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
<!-- Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable
installation campaign reporting -->
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
<!-- ... -->
我通过终端
传递以下命令adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.example.pranav.ui/com.google.analytics.tracking.android.CampaignTrackingReceiver --es "referrer" "utm_source=pranav&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign"
我收到adb shell的以下回复
广播:意图{act = com.android.vending.INSTALL_REFERRER CMP = com.example.pranav.ui / com.google.analytics.tracking.android.CampaignTrackingReceiver (有额外的)}广播完成:结果= 0
根据https://developers.google.com/analytics/solutions/testing-play-campaigns
上给出的指南,到目前为止一切都在发生但是我没有获取广告系列参数,而是在Logcat上收到以下内容
AnalyticsReceiver未注册或已禁用。注册 接收器,用于在非Google Play设备上进行可靠的调度