Home » Android » android – AdvertisingIdClient#getAdvertisingIdInfo sometimes returns null since v9.8.0

android – AdvertisingIdClient#getAdvertisingIdInfo sometimes returns null since v9.8.0

Posted by: admin May 14, 2020 Leave a comment

Questions:

I got an issue since I bumped the play-services version to v9.8.0. I notice that the method AdvertisingIdClient#getAdvertisingIdInfo sometimes returns null (i have not identified any pattern to reproduce this case yet).

Do you if this a new behavior of this API (The documentation is not clear whether this method may return null or not) or if this a bug i should report to play services developers ?

This is a breaking change for me because I use some sdk which use this method without checking the returned value nullity.

Thanks !

How to&Answers:

I’m seeing this too, but can’t find any useful links about it. If you use Android Studio to decompile the getAdvertisingIdInfo method you can clearly see a path where it will return null but the docs don’t see to think that is possible. I can’t find anywhere to report a bug, it’s probably safest to just update your code to check for null.