I am trying to register a Broadcast Receiver that catches "com.android.vending.INSTALL_REFERRER" intents launched by Android after an app is installed from the Market.
I am following the details here: http://code.google.com/mobile/analytics/docs/android/#referrals
However, I cannot use Google Analytics so I have created my own solution. I have added the following to my manifest file:
<receiver android:name="com.test.Receiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
and created a basic BroadcastReceiver class:
public class Receiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
String referrerString = extras.getString("referrer");
Log.w("TEST", "Referrer is: " + referrerString);
}
}
However, when the app is installed the receiver doesn't seem to catch the Intent (if the Intent is even broadcast?) and I get no logging output.
Am I going wrong somewhere or is the Market no longer launching these Intents when an app is installed?
I would try to help who, like me, fails to make install_referrer work and who don't find ANY useful information about these features.
Notes:
com.android.vending.INSTALL_REFERRER
will be caught
during the install process, not when the application starts for the
first time.extras.getString("referrer")
.. is fixed but the contents can be any string value that respect the http get syntax ...referrer=thatsthevalue&thisisnot=xxx
The above code is okay, just some explanations to complete the info:
<receiver>
tags must be inside the
<application>
tags.but this one
Obviously, you need to follow the link from the mobile device and the only way for a complete test is to publish a test application in the market.
And a final and personal note.
I don't understand why those info are omitted completely and i hope that Google will act for detailing it.