Google Play Games Online
Google Play Games is Google's answer to the iPhone's 'Game Center'; it allows users to easily track their progress in games and compare it to their friends' progress.
Google Play Games was a very necessary addition to the Android game family. It establishes a universal baseline for gameplay and comes complete with achievements, levels, high scores, and more. It makes the Android feel a lot more like a gaming community platform rather than a bunch of isolated apps to play alone. Unfortunately, this was a little bit late to the gaming ring. Apple's Game Center was so successful because it was included with iOS by default.
- Five years after the end of the Civil War, Captain Jefferson Kyle Kidd (Tom Hanks), a widower and veteran of three wars, now moves from town to town as a non-fiction storyteller, sharing the news of presidents and queens, glorious feuds, devastating catastrophes, and gripping adventures from the far reaches of the globe.
- Games at Miniclip. Welcome to Miniclip.com, the leading online games site, where you can play a huge range of free online games including action games, sports games, puzzle games, mobile games, iPhone games, Android games and many more.
Google Play Games is an online gaming service and software development kit operated by Google, part of its Google Play product line, for the Android operating system. It features gamer profiles, cloud saves, social and public leaderboards, achievements, and real-time multiplayer gaming capabilities.
There's no argument that Google Play Games is a sturdy piece of software. Reviews are generally positive, and there are no known major bugs. However, because it's not included by default, many players aren't aware that it exists or do not care enough to install it. Additionally, it's not automatically integrated in games due to the Android app store's decentralized nature. If more players would join the system, Google Play Games would make for a very fun, universal experience.
In short, this app is a great concept and executed well. Players can easily access their stats and compare them to other players. The achievements feature is especially interesting and makes it feel almost like a console gaming experience. Nonetheless, most players would agree that what makes any multiplayer gaming platform is the player count. Google Play Games just doesn't have the player count, but there's no doubt it will eventually amass many more players.
Pros:
- Gives Android a community gaming experience
- Outstanding achievement unlock system
Cons:
- Not a high enough player count
- Not integrated into Android OS by default
In order to access Google Play games services functionality, your game needs to provide thesigned-in player’s account. If the player is not authenticated, your game may encounter errorswhen making calls to the Google Play games services APIs. This documentation describes how toimplement a seamless sign-in experience in your game.
Implementing player sign-in
Google Play Games online, free
The GoogleSignInClient
class is the main entry point to retrieve the account of the currentlysigned-in player, and to sign-in the player if they have not previously done so on your app in thedevice.
GoogleSignInClient
class makes use of theGoogle Play services Task
class to return results asynchronously. To learn more about using tasks to manage threaded work,see the Tasks API developer guide.To create a sign-in client, follow these steps:
Create a sign-in client via the
GoogleSignInOptions
object, as shown in the following code snippet. In theGoogleSignInOptions.Builder
to configure your sign-in, you must specifyGoogleSignInOptions.DEFAULT_GAMES_SIGN_IN
.If you want to use a
Caution: Don't request any other scopes or Google profile data unlessthey're essential for your use case. Any other scope causes the first timesilent sign-in to fail, except for users who have already signed insuccessfully on a different device.SnapshotsClient
,then you need to add.requestScopes(Drive.SCOPE_APPFOLDER)
to yourGoogleSignInOptions.Builder
,as shown in the following code snippet:Call the
GoogleSignIn.getClient()
method and pass inthe options that you configured in the previous steps. If the call issuccessful, the Google Sign-In API returns an instance ofGoogleSignInClient
.
Check whether player is already signed in
You can check whether an account is already signed inon the current device using GoogleSignIn.getLastSignedInAccount()
and whether this account already has the required permissions granted usingGoogleSignIn.hasPermissions()
.If both conditions are true—that is, getLastSignedInAccount()
returns anon-null value and hasPermissions()
returns true
—you can safely usethe account returned from getLastSignedInAccount()
, even if the device isoffline.
Performing silent sign-in
You can call silentSignIn()
to retrieve the currently signed-in player’s account,and try to sign players in without displaying a user interface if they havesuccessfully signed in to your app on a different device.
The silentSignIn()
method returns a Task<GoogleSignInAccount>
. When the task completes,you set the GoogleSignInAccount
field you declared earlier to the sign-in account that the taskreturns as the result, or to null
, indicating there is not a signed-in user.
If the silent sign-in attempt fails, you can optionally send the sign-in intent to display asign-in user interface, as described inPerforming interactive sign-in.
Since the state of the signed-in player can change when the activity is not in the foreground, werecommended calling silentSignIn()
from the activity'sonResume()
method.
Google Play Games For Computer
To perform the sign-in silently, follow these steps:
- Call the
silentSignIn()
method on theGoogleSignInClient
to start the silent sign-in flow.This call returns anTask<GoogleSignInAccount>
object which contains aGoogleSignInAccount
ifsilent sign-in is succesful. - Handle the success or failure of the player sign-in by overriding
OnCompleteListener
.- If the sign-in task was successful, get the
GoogleSignInAccount
object by callinggetResult()
. - If sign-in was not successful, you can send a sign-in intent to launch an interactive sign-in flow.For a list of additional callback listeners you can use, see theTasks API developer guideand
Task
API reference.
- If the sign-in task was successful, get the
The following code snippet shows how your app can perform silent sign-in:
If the silent sign-in attempt fails, you can callgetException()
toobtain an ApiException
with the detailed status code. A status code of CommonStatusCodes.SIGN_IN_REQUIRED
indicates that the player needs to take explicit action to sign-in. In this case, your app shouldlaunch an interactive sign-in flow as described in the next section.
Performing interactive sign-in
To sign in with player interaction, your app needs to launch the sign-in intent. If successful,the Google Sign-In API displays a user interface that prompts the player to enter their credentialsto sign in. This approach simplifies your app development, since the sign-in activity handlesscenarios such as needing to update Google Play services or showing consent prompts, on your app’sbehalf. The result is returned via theonActivityResult
callback.
To perform the sign-in interactively, follow these steps:
Call
getSigninIntent()
on theGoogleSignInClient
to obtain a sign-in intent, then callstartActivity()
and pass in that intent. The following code snippet shows how your app canlaunch an interactive sign-in flow:In the
onActivityResult()
callback, handle the result from the returned intent.- If the sign-in result was successful, get the
GoogleSignInAccount
object from theGoogleSignInResult
. - If sign-in result was not successful, you should handle the sign-in error (for example, bydisplaying an error message in an alert).The following code snippet shows how your app can handle the results of player sign-in:
- If the sign-in result was successful, get the
Retrieving player information
The GoogleSignInAccount
that the Google Sign-In API returns does not contain any playerinformation. If your game uses player information, such as the player’s display name and player ID,you can follow these steps to retrieve this information.
- Obtain a
PlayersClient
object by calling thegetPlayersClient()
method, and passing intheGoogleSignInAccount
as a parameter. - Use the
PlayersClient
methods to asynchronously load thePlayer
object that contains a player’s information. For example, you can callgetCurrentPlayer()
to load the currently signed-in player. If the task returns anApiException
with status codeofSIGN_IN_REQUIRED
,this indicates that the player needs to be re-authenticated. To do this, callGoogleSignInClient.getSignInIntent()
to sign in the player interactively. - If the task successfully returns the
Player
object, you can then call the methods of thePlayer
object to retrieve specific player details (for example,getDisplayName()
orgetPlayerId()
.
Google Games Online Play Free
Providing a sign-in button
To provide a standard Google sign-in button in your game, you can use one ofthese approaches:
Google Play Games online, free
- Include a
com.google.android.gms.common.SignInButton
on the main activity layout; or - Design a custom sign-in button according to the Google Sign-In brandingguidelines.
When users click the sign-in button, your game should initiate the sign-in flow by sending asign-in intent, as described in Performing interactive sign-in.
This code snippet shows how you can add a sign-in button in the onCreate()
method for your activity.
The following code snippet shows how you can send the sign-in intent when the user clicks on thesign-in button.
Displaying game pop-ups
You can display pop-up views in your game using the GamesClient
class. For example, your gamecan display a “Welcome back” or an “Achievements unlocked” pop-up. To allow Google Play games servicesto launch pop-ups in views in your game, call thesetViewForPopups()
method. You can further customize where the pop-up appears in the screen by callingsetGravityForPopups()
.
Signing the player out
Signing-out is done via call the signOut()
method on the GoogleSignInClient
.