Play thousands of free online games: arcade games, puzzle games, funny games, sports games, shooting games, and more. New free games every day at AddictingGames. Games at Y8.com. Yahoo was the first website ever to have a game section and they helped pioneer the browser game genre. They were well known for card, board, and sports games from the early internet around the year 1998 and remained popular for several years before other game portals gained traction. Discover a personalized experience like never before with the Yahoo app. Make the app your own by following celebrities, companies, and teams you're interested in and creating your own video channel with the topics you follow. Get local weather, sports scores and highlights, top news and entertainment stories & videos, stock quotes, coupons from your email and more - all your Yahoo favorites. Play the best free Mahjongg and Mahjong Games online including games like Mahjong Fortuna, Mahjong Solitaire, Majong, Connect, Mahjong Online, Mahjongg 3D, Mahjongg Dimensions and Towers.
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
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
. 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.
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
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. Play pokies on line.
- 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()
.
Providing a sign-in button
To provide a standard Google sign-in button in your game, you can use one ofthese approaches:
- 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.
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. Play pokies on line.
- 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()
.
Providing a sign-in button
To provide a standard Google sign-in button in your game, you can use one ofthese approaches:
- 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
Play Yahoo Games online, free
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
Games Logins For Girl
Signing-out is done via call the signOut()
method on the GoogleSignInClient
.