简体   繁体   中英

Allow more than one person to sign into Google Play Games services?

I have set up Google Play Games services using BaseGameActivity and GameHelper. When I first launched the app, a prompt appeared asking if the game can connect to my account. This is okay for me. However after I sign out and use beginUserInitiatedSignIn() to sign in again, I cannot choose to login in as another user. It logs in automatically to the previous account. How is it possible for there to be an option for multiple users of the same game on the same device?

Update:

I have just noticed that if more than one person has logged into Google+ on the same device, then when the game tries to login to the Games services it will allow the user to choose from the various profiles that had logged into Google+. This of course means that people must login into Google+ (or maybe any Google software) before they are given the option to login to the Games services.

You can get the account selection dialog to be displayed by calling

mHelper.signOut();

Now the next time you try to sign-in, the dialog will be displayed, allowing the user to choose an account. Notice that signOut() is different from disconnect() in that it clears the default account, which allows account selecting at next connection attempt. In other words, only use signOut() if you want to select a new account, not every time the player exits the game (in that case use the default disconnect() ).

So if you want to "switch accounts" you can just do the following for a button click (or whatever you need):

mHelper.signOut();
mHelper.beginUserInitiatedSignIn();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM