インストール時に市場リンクを介してアプリにパラメーターを渡すこと について、最初にこの質問をしました。
BroadcastListener
のintent-filter
アクションでを作れとみんな言ってるようですcom.android.vending.INSTALL_REFERRER
。それに関するすべてのドキュメントは、これが Google Analytics の機能であることを暗示しているようです (ドキュメントは v1 にありますが、現時点では v2 SDK しかダウンロードできないため、私はそれを使用しています)。これらのリンクからデータを渡すことができません。完全なマニフェストとブロードキャスト リスナーがあります。必要な場合に備えて、Google アナリティクスを含めました。
- Google アナリティクス リファレンス
- ここから市場へのリンクを生成
- ストア内の私のアプリへのリンク
- ストア内のパラメーターとのリンク
まったく機能しません。ブロードキャスト リスナーが呼び出されることはなく、ログには何も出力されません。ヘルプ!
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>
ブロードキャスト リスナー
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");
}
}
}