5
\$\begingroup\$

I'm developing an online Android game with Unity. I want all Google Play accounts to have only one session logged in at a time.

Do I need to write my own code to disconnect an existing session on new login attempts, or does Google Play already handle this?


Edit:

An idea popped to my mind. I can save the logged in device's state to a a file on Google's Saved Games cloud, and write an instance-specific identifier to that file that indicates who has logged on last. And checking file constantly on all instances will allow me to disconnect instances whose identifier doesn't match the one on the file on the cloud.

Do you think this is a good idea? I mean, fetching file from cloud every second or so?

\$\endgroup\$
1
\$\begingroup\$

I just found this as an explanation of one of the members of ConflictResolutionStrategy enum in GooglePlayGames.BasicApi.SavedGame namespace in SDK:

    /// <summary>
    /// Choose the version of the saved game that existed before any conflicting write occurred.
    /// Consider the following case:
    /// - An initial version of a save game ("X") is written from a device ("Dev_A")
    /// - The save game X is downloaded by another device ("Dev_B").
    /// - Dev_A writes a new version of the save game to the cloud ("Y")
    /// - Dev_B does not see the new save game Y, and attempts to write a new save game ("Z").
    /// - Since Dev_B is performing a write using out of date information, a conflict is generated.
    ///
    /// In this situation, we can resolve the conflict by declaring either keeping Y as the
    /// canonical version of the saved game (i.e. choose "original" aka <see cref="UseOriginal"/>),
    /// or by overwriting it with conflicting value, Z (i.e. choose "unmerged" aka
    /// <see cref="UseUnmerged"/>).
    /// </summary>

So i think the answer of my question is "yes".

\$\endgroup\$
-1
\$\begingroup\$

According to Google Developers Guide, Google Play Services will not check or sign out other instances of the app on other devices. You will have to sign other users out manually using your own code.

\$\endgroup\$
  • 2
    \$\begingroup\$ This does not answer the question. You should talk about experience as a developer, not as a user: maybe bethesda chose to not use that feature offered by Google. The OP wants to have the user disconnected, your answer does not take that into consideration. \$\endgroup\$ – Alexandre Vaillancourt Oct 30 '15 at 21:55
  • 1
    \$\begingroup\$ I'm not talking about other instances of app, i'm talking about two different devices running the app. So this answer led me to nowhere. \$\endgroup\$ – S. Tarık Çetin Oct 31 '15 at 11:04
  • \$\begingroup\$ @Samed That is what I meant. \$\endgroup\$ – ZEKE Oct 31 '15 at 12:15
  • \$\begingroup\$ @ZEKE The link you gave just tells how to disconnect users, or checking if the "local" instance signed in or not, how you get this answer from that link? \$\endgroup\$ – S. Tarık Çetin Oct 31 '15 at 13:05
  • \$\begingroup\$ @Samed If there was an easy way to only allow one login at a time, it would be there. There is also no mention of it the Documentation \$\endgroup\$ – ZEKE Oct 31 '15 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.