Play Games Services sign-in provides you with a player's gaming identity, which is a platform-level, gaming-specific identity for Android players. This identity helps build a relationship between your game and the player. Players are more willing to use this identity to sign in than with alternate centralized systems.
In addition, sign-in gives you a strong, consistent identifier that you can use as a key to a cloud save system. Cloud save is highly-valued; it enables players to do the following:
- Pick up where they left off if they change or reset their device
- Play the game on multiple devices (for example, on another phone or a Chromebook)
- Uninstall and later re-install the game
You can use Play Games Services identity as a key for your own cloud save solution, or you can use the free Saved Games service.
Play Games Services (PGS) supports automatic sign-in, a zero-friction way to sign in players.
Recommended sign-in flow
In order to successfully sign players into your game, use the following sign-in flow:
- During the startup sequence of your game, Automatic sign-in will trigger, attempting to login the user or create a new account.
- If automatic sign-in does not work or the user declines, then show a manual sign-in button in case the user would like to login later on.
Automatic sign-in allows users to sign into your game with zero friction - it's automatic! If your game requests that the user sign in and the automatic sign-in setting is enabled (in the Google Play Games app), then you will receive the user's PGS identity credentials and the user will see the PGS sign-in experience.
Automatic sign-in is a setting users can control. Users can choose to automatically sign into all games or be asked each time.
OAuth Scopes and PGS
PGS relies on the OAuth system to allow users to
give your game access to their account. PGS has a unique scope for games (
games-lite) and relies on another scope
drive.app_data) if your game uses the saved games feature. The saved games
feature gives access to the user's Google Drive account, which is where the game
data is stored.
Support for multiple sign-in methods
PGS provides a gaming identity for Android players, but it doesn't need to be the only identity connected to your users. You can sign in players using PGS, a social network ID, and your own in-game ID system all at the same time. Each system provides unique value for both you and your players, and all can work together to make a great experience for Android players.
Securely retrieve and verify the player identity for backend integration
You can request a Server Auth code to enable your server to talk directly to the Play Games Services servers via the REST API with the authority of the signed-in player. This enables direct access to the player's ID, profile, and other information (such as friends list, if authorized). If you store any Player IDs, friend IDs, or other related data in your backend, this method must be used to remove the potential for device-side manipulation of these fields.
Additionally, for some older games and players, the player ID returned by the
Android SDK for a player may not be the same ID that other players see when
viewing that player in the same game - this is particularly relevant when using
the friends list. However, the
player_id returned within the REST API is
always consistent and is always the ID that is seen by other players.
To learn how to implement sign-in support on Android, see Sign-in in Android Games.