Home » Android » Is it possible to get the android advertising id without adding play services ads dependency?

Is it possible to get the android advertising id without adding play services ads dependency?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am using the google play ads dependency just to get the advertising id.

com.google.android.gms:play-services-ads:7.8.0

Is there any way to avoid this as the library has a method count of 6201.

How to&Answers:

AdvertisingIdClient and its associated classes are also found in the much smaller

com.google.android.gms:play-services-basement:8.3.0

if you use Google Play services 8.3. Prior to that point, you are correct in that it was part of play-services-ads.

In any case, it is strongly recommended that you use ProGuard to remove unused code from your app before shipping retail versions of your app.