【问题标题】:android, which dependency to use if needs AdvertisingIdClientandroid,如果需要 AdvertisingIdClient 则使用哪个依赖项
【发布时间】:2021-05-17 18:32:05
【问题描述】:

具有获取 AdvertisingIdClient.Info 的功能

private static AdvertisingIdClient.Info getAdsClientInfo(@NonNull final Context context) throws GooglePlayServicesNotAvailableException, IOException, GooglePlayServicesRepairableException {
    int isGPAvailable = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
    if (isGPAvailable == ConnectionResult.SUCCESS) {
        return AdvertisingIdClient.getAdvertisingIdInfo(context);
    }
    return null;
}

它使用 AdvertisingIdClient.getAdvertisingIdInfo(context)

https://developers.google.com/android/guides/setup中有三个库

Google Mobile Ads   com.google.android.gms:play-services-ads:20.1.0
Android Advertising ID (AAID)   com.google.android.gms:play-services-ads-identifier:17.0.0
Lightweight version of Google Mobile Ads com.google.android.gms:play-services-ads-lite:20.1.0

它们之间有什么区别,哪一种可以安全使用?

【问题讨论】:

    标签: android google-play-services google-ads-api


    【解决方案1】:

    事实证明com.google.android.gms:play-services-ads-identifier:17.0.0 适合这种情况,但将GoogleApiAvailability 更改为GoogleApiAvailabilityLight 它将包含在此依赖项中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-21
      • 2014-01-24
      • 1970-01-01
      • 1970-01-01
      • 2022-08-21
      • 1970-01-01
      • 2016-09-28
      • 2018-09-20
      相关资源
      最近更新 更多