gpt4 book ai didi

android - install_referrer Intent 弃用和更新库

转载 作者:行者123 更新时间:2023-12-03 13:26:42 25 4
gpt4 key购买 nike

我收到了来自谷歌的电子邮件:

We recently announced that we’ll be deprecating the install_referrer intent broadcast mechanism. Because one or more of your apps uses this intent to track referrals, we wanted to ensure you make the switch before March 1, 2020. After this date, new versions of the Play Store app will no longer broadcast the install_referrer intent after app installs.



我在 Stack 上检查了这个答案: install_referrer intent deprecation并遵循等待 Firebase 库更新的建议,现在我将我的项目更新到最新版本,但仍然在 package="com.google.firebase.measurement_impl"下的 list 合并中进入 INSTALL_REFERRER
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.firebase.measurement_impl" >

<uses-sdk android:minSdkVersion="14" />

<!-- Required permission for App measurement to run. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />

<application>
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>

这里是我在项目中使用的 firebase 版本
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
implementation 'com.google.firebase:firebase-config:19.1.1'
implementation 'com.google.firebase:firebase-auth:19.2.0'

现在 5 天后,3 月 1 日将到来,我没有找到解决这个问题的方法

最佳答案

Google 的 installreferrer 库解决了这个问题。

implementation 'com.android.installreferrer:installreferrer:1.1'

关注此 link了解实现。
在您的应用程序的启动 Activity 中初始化客户端。
InstallReferrerClient referrerClient;
referrerClient = InstallReferrerClient.newBuilder(this).build();
referrerClient.startConnection(
....
);

成功初始化客户端后,您可以存储从以下代码获得的引荐来源数据。
ReferrerDetails response = referrerClient.getInstallReferrer();
String referrerUrl = response.getInstallReferrer();

根据谷歌:

The install referrer information will be available for 90 days and won't change unless the application is reinstalled. To avoid unnecessary API calls in your app, you should invoke the API only once during the first execution after install.

关于android - install_referrer Intent 弃用和更新库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60414445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com