如何检测推荐 Android
How Detected Referrals Android
我想找出一种方法来检测通过推荐下载的应用程序。
首先,我不想使用用户输入的任何推荐代码。这是我真正需要的:
1.Here 是我的推荐 link
http://affiliate.flipkart.com/install-app?affid=Inflation
(其中 affliate/refferal ID 为 Inflation)
2.Now 当有人使用推荐下载我的应用时 link 所以他会重定向到 playstore。
3.After 成功安装如何在应用程序中检测推荐 ID ????(不使用用户交互)
是否有任何 google 播放服务 api 来检测哪个 link 属于 playstore???
实际上有一个应用程序是这样做的,但我不知道它是如何工作的...
谢谢
更新(2017 年 11 月 30 日)
Google 引入了 Google Play 商店的 Install Referrer API 以安全地从 Google Play 检索推荐内容。以后我更愿意去。
Using INSTALL_REFERRER broadcast for Google Play Campaign
Measurement
1) 在 google 中构建您的应用 URL 玩这样的东西
https://play.google.com/store/apps/details?id=com.hello&referrer=tracking_id%3D123456789
或使用
其中referrer
参数可能有campaigner的唯一值。
2) 在您的应用程序中定义一个接收器 manifest.in 当应用程序从 google play..
<receiver android:name="com.package.Tracker" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
3) 广播接收器
public class Tracker extends BroadcastReceiver {
private String referrer = "";
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
Bundle extras = intent.getExtras();
if (extras != null) {
referrer = extras.getString("referrer");
}
Log.i("REFERRER", "Referer is: " + referrer);
}
}
}
获得活动家详细信息后,您可以将其提交给 google analytics for Campaign measurement。
您可以在终端中测试您的应用程序配置运行此命令:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER
-n your.package.name/path.to.receiver --es referrer
--es referrer "EXTRA_STRING_VALUE"
例如,如果您的包名称是 com.hello 并且您的接收器的路径是 com.ex.Tracker 测试命令将是:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER
-n "com.hello/com.ex.Tracker"
--es referrer "tracking_id=123456789"
对于 more about working or you can also take a look at third party SDK,它也提供 UI,但它的成本..
最近 Google 发布了 Google Play Install Referrer API 以简化推荐检索过程并使其更加可靠。
基本上,现在你必须 1) link 图书馆:
dependencies {
...
compile 'com.android.installreferrer:installreferrer:1.0'
}
2) 建立连接到 Google 播放:
InstallReferrerClient mReferrerClient
...
mReferrerClient = newBuilder(this).build();
mReferrerClient.startConnection(this);
3) 获取推荐人:
ReferrerDetails response = mReferrerClient.getInstallReferrer();
更多详情:https://android-developers.googleblog.com/2017/11/google-play-referrer-api-track-and.html
我想找出一种方法来检测通过推荐下载的应用程序。 首先,我不想使用用户输入的任何推荐代码。这是我真正需要的:
1.Here 是我的推荐 link http://affiliate.flipkart.com/install-app?affid=Inflation
(其中 affliate/refferal ID 为 Inflation)
2.Now 当有人使用推荐下载我的应用时 link 所以他会重定向到 playstore。
3.After 成功安装如何在应用程序中检测推荐 ID ????(不使用用户交互)
是否有任何 google 播放服务 api 来检测哪个 link 属于 playstore???
实际上有一个应用程序是这样做的,但我不知道它是如何工作的... 谢谢
更新(2017 年 11 月 30 日)
Google 引入了 Google Play 商店的 Install Referrer API 以安全地从 Google Play 检索推荐内容。以后我更愿意去。
Using INSTALL_REFERRER broadcast for Google Play Campaign Measurement
1) 在 google 中构建您的应用 URL 玩这样的东西
https://play.google.com/store/apps/details?id=com.hello&referrer=tracking_id%3D123456789
或使用
其中referrer
参数可能有campaigner的唯一值。
2) 在您的应用程序中定义一个接收器 manifest.in 当应用程序从 google play..
<receiver android:name="com.package.Tracker" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
3) 广播接收器
public class Tracker extends BroadcastReceiver {
private String referrer = "";
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
Bundle extras = intent.getExtras();
if (extras != null) {
referrer = extras.getString("referrer");
}
Log.i("REFERRER", "Referer is: " + referrer);
}
}
}
获得活动家详细信息后,您可以将其提交给 google analytics for Campaign measurement。
您可以在终端中测试您的应用程序配置运行此命令:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER
-n your.package.name/path.to.receiver --es referrer
--es referrer "EXTRA_STRING_VALUE"
例如,如果您的包名称是 com.hello 并且您的接收器的路径是 com.ex.Tracker 测试命令将是:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER
-n "com.hello/com.ex.Tracker"
--es referrer "tracking_id=123456789"
对于 more about working or you can also take a look at third party SDK,它也提供 UI,但它的成本..
最近 Google 发布了 Google Play Install Referrer API 以简化推荐检索过程并使其更加可靠。
基本上,现在你必须 1) link 图书馆:
dependencies {
...
compile 'com.android.installreferrer:installreferrer:1.0'
}
2) 建立连接到 Google 播放:
InstallReferrerClient mReferrerClient
...
mReferrerClient = newBuilder(this).build();
mReferrerClient.startConnection(this);
3) 获取推荐人:
ReferrerDetails response = mReferrerClient.getInstallReferrer();
更多详情:https://android-developers.googleblog.com/2017/11/google-play-referrer-api-track-and.html