5

I have incorporated the newer google play game services into my app, and I can see that upon start up of my app, there is an automatic sign in. I was wondering if this could be disabled as I would like to give that option to the user. I have searched the code provided by BaseGameUtils, but I cant see any sign in functions being called anywhere.

Any help would be appreciated!

Thanks :)

opposite of you
  • 1,295
  • 1
  • 11
  • 16

2 Answers2

9

As per this issue, auto sign on is the recommended pattern as stated in their best practices video. As they point out in the FAQ (questions 4 and 5):

[4] Why is GameHelper/BaseGameActivity attempting to sign in on application startup?

The default behavior of BaseGameActivity and GameHelper is to show the user the sign-in flow (consent dialogs, etc) as soon as your application starts. Naturally, once the user signs in for the first time, they won't see the consent flow again, so it will be a seamless experience. It is important for the user to sign in as early as possible so your application can take advantage of the Google Play Games API right away (for example, saving the user's progress using Cloud Save, unlocking achievements, etc). If the user cancels the sign-in flow, BaseGameAcitivity/GameHelper will remember that cancellation. If the total number of cancellations reaches a predefined maximum (by default, 3), the user will no longer be prompted to sign in on application startup. If that happens, they can still sign in by clicking your application's Sign In button, if you provide one.

[5] I don't like the new "auto sign in" feature of GameHelper. How can I disable it?

To disable this feature and return to the old behavior, you can edit GameHelper.java and set the DEFAULT_MAX_SIGN_IN_ATTEMPTS constant to 0, or call GameHelper.setMaxAutoSignInAttempts(0) at runtime, before calling GameHelper.setup() (or, correspondingly, from your Activity's onCreate method).

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • Thank you so much! I didn't even know this video existed. I just accidentally updated with my SDK Manager and it destroyed everything - I didn't even realise there was an update to google play games, so I have been rewriting my achievenemt/leaderboard logic. Thanks again!! – opposite of you Mar 31 '14 at 09:44
0

Yes it is possible. I know it is an old question, but I was searching for an answer and I couldn't find easily (Thanks Google). This question pops up the first, so from another question, the answer is to use getGameHelper().setMaxAutoSignInAttempts(0);. As mentioned here.

Community
  • 1
  • 1
Ahmed Ekri
  • 4,601
  • 3
  • 23
  • 42