我发现此脚本可以测试收到的Google广告系列参数:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.accuweather.android/com.accuweather.android.services.GoogleCampaignTrackingReceiver --es "referrer" "utm_source=test_androidlite_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"
以下是我为测试目的而收到的信息:
public class GoogleCampaignTrackingReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
String referrerString = extras.getString("referrer");
Logger.i(this, "referrer string is %s", referrerString);
}
}
我想知道如何得到所有参数,而不仅仅是第一个?这是日志声明:
03-13 18:40:41.990: I/GoogleCampaignTrackingReceiver(30212): referrer string is utm_source=test_androidlite_source
答案 0 :(得分:2)
我遇到了同样的问题,花了几个小时才找到答案。 在我的情况下,我发送广播
./ adb shell am broadcast -a com.android.vending.INSTALL_REFERRER --es “引荐” “交通= TEST1&安培; MD = 1T1&安培; utm_source = TEST1&安培; utm_medium =机器人&安培; utm_campaign =&TEST12放大器; utm_term = T3&安培;的utm_content = T5
只获得第一个参数
解决方案很简单 - 您需要先输入adb shell
./ adb shell
然后发送你的广播
shell @ android:/ $ am broadcast -a com.android.vending.INSTALL_REFERRER --es “引荐” “交通= TEST1&安培; MD = 1T1&安培; utm_source = TEST1&安培; utm_medium =机器人&安培; utm_campaign =&TEST12放大器; utm_term = T3&安培;的utm_content = T5
所有参数都将被正确接收。 我希望它会有用,因为我没有找到这样的解释