I originally asked this question, about passing parameters through a market link into my app on install.
Everyone seems to be saying to create a BroadcastListener
with the intent-filter
action of com.android.vending.INSTALL_REFERRER
. All the documentation on that seems to imply this is a capability of Google Analytics (the documentation is in v1, but I can only download v2 SDK at this point... so that's what I am using). I can't get these links to pass data through. I have my full manifest and my broadcast listener. I have included Google Analytics just in case that was a requirement.
- Google Analytics Reference
- Generated link to market from here
- Link to my app in the store
- Link with parameters in the store
It doesn't work at all. My broadcast listener is never called, nothing gets printed out in the logs. Help!
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.robotsidekick.webbrowser"
android:versionCode="4"
android:versionName="4.0">
<uses-sdk android:minSdkVersion="17"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher">
<activity
android:name="WebBrowser"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver
android:exported="true"
android:name="com.robotsidekick.webbrowser.InstallReceiver">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>
</manifest>
Broadcast Listener
public class InstallReceiver extends BroadcastReceiver
{
private static final String TAG = "InstallReceiver";
public void onReceive(Context context, Intent intent)
{
Log.e(TAG, "Context: " + context);
Bundle extras = intent.getExtras();
if (extras != null)
{
Log.e(TAG, "Extras:");
for (String keys : extras.keySet())
{
Log.e(TAG, keys + " -> " + extras.get(keys));
}
}
else
{
Log.e(TAG, "Extras are null");
}
}
}
InstallReceiver
to extendcom.google.analytics.tracking.android.AnalyticsReceiver
instead and everything magically worked. I honestly can't explain it. – Snug