Question

I have an Android app which had Google Play Games working fine. I then updated to the newer version of BaseGameUtils (and google-play-services_lib) about a week ago and have been having trouble with signing in to Play Games Services. When the user is not signed IN (deliberately - by not clicking the sign in button), the sign-in flow for Play Games Services is launched every time that a BaseGameActivity is started. How do I prevent this from happening?

The behaviour I want is that the user has to voluntarily click the sign-in button for the sign-in flow to appear, and then will be automatically signed in every time unless they explicitly sign-out. (This is what used to happen until I updated).

If signed in the behaviour is as normal. The problem is only when the user is not signed in.

Was it helpful?

Solution

The reason is it was added on purpose by Google. Their FAQ section for BaseGameUtils answers this question.

From the FAQ:

[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).

I used DEFAULT_MAX_SIGN_IN_ATTEMPTS = 0. Worked perfectly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top