Reputation: 1493
The problem is that i cannot get referrer uri in my receiver. In manifest file i have something like:
<receiver
android:name="app.InstallReceiver"
android:exported="true" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
Adb broadcast command:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER
-n app/app.InstallReceiver --es "referrer" "utm_source=testSource&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign"
In InstallReceiver class:
@Override
public void onReceive(Context context, Intent intent) {
Uri uri = intent.getData(); // getting uri is null
String referrer = intent.getStringExtra("referrer");
// referrer is only contains "utm_source=testSource" and no more
So the question is where the full referrer and what's wrong with my intent.
Upvotes: 3
Views: 2574
Reputation: 5767
Your intent
broadcast referrer value doesn't get set correctly. The value will be escaped once by the shell calling adb
and one more time by the Android shell executing the broadcast command. Try sending the request like this:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n app/app.InstallReceiver --es referrer "'utm_source=testSource&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign'"
Note the double escaping - once with single quote ' and once with double quotes "
Upvotes: 10