Get user ID from Google Play Services?

Is there a way to get the Google Play ID (number, line, whatever) from a specific user when using Google Play services?

+8
android google-play-services google-play
source share
2 answers

For Google Play gaming services, you can use:

String playerId = Games.Players.getCurrentPlayerId(getApiClient()); 
+21
source share

It depends on the service you are trying to access. Here is the corresponding Player class for Google Play games: https://developer.android.com/reference/com/google/android/gms/games/Player.html

And the corresponding People class from Google Plus: https://developer.android.com/reference/com/google/android/gms/plus/model/people/package-summary.html

Finally, there is AdvertisingIdClient for the Google Mobile Ads platform: https://developer.android.com/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.html

+3
source share

All Articles