问题描述
我注意到浏览器中的一些Google Play应用链接对他们来说具有 referrer =
属性,这显然会告诉转介者将您发送到Google Play中该应用的页面。
是否有可能在我的应用程序的代码中看到引用者(如果有)?如果没有,在任何地方都可以看到它? 可以使用 com.android.vending .INSTALL_REFERRER
。 b
$ b
将此接收器添加到AndroidManifest.xml
< receiver
android:name =com.example.android.InstallReferrerReceiver
android:exported =true
android:permission =android.permission.INSTALL_PACKAGES >
< intent-filter>
< / intent-filter>
< / receiver>
创建BroadcastReceiver:
public class InstallReferrerReceiver extends BroadcastReceiver {
@Override $ b $ public void onReceive(Context context,Intent intent){
String referrer = intent.getStringExtra(referrer);
//使用引用者
$ / code>
您可以按照此的步骤来测试引荐跟踪。
I have noticed some Google Play app links in the browser has the referrer=
attribute to them, which obviously tells the referrer that sent you to that app's page in Google Play.
Is it possible to see that referrer (if any) in the code of my app? And if not, to see it anywhere at all?
You can use com.android.vending.INSTALL_REFERRER
.
Add this receiver to AndroidManifest.xml
<receiver
android:name="com.example.android.InstallReferrerReceiver"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
Create a BroadcastReceiver:
public class InstallReferrerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String referrer = intent.getStringExtra("referrer");
//Use the referrer
}
}
You can test the referral tracking following the steps of this answer.
这篇关于Android - 是否有可能以编程方式获取安装引荐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!