having function to get 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; } 

it uses AdvertisingIdClient.getAdvertisingIdInfo(context)

there are three libs in 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 

what are the difference among these, and which one is safe to use for the purpose?

Tag:google-ads-api, android, google-play-services

Only one comment.

  1. lannyf

    It turns out that com.google.android.gms:play-services-ads-identifier:17.0.0 is fine for this case but change the GoogleApiAvailability to GoogleApiAvailabilityLight and it will be included in this dependency.

Add a new comment.