Question

I have recently updated the Google Play Services library within my app to use the new Google API. In doing so, whenever I start an Activity (which extends BaseGameActivity) for the first time without being signed in, the Activity automatically comes up with the sign in dialog.

I have not made any beginUserInitiatedSignIn() calls anywhere. This is quite annoying - is there a way round this?

Here is a logcat:

03-02 21:13:08.067: W/PopupManager(12332): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
03-02 21:13:08.137: D/dalvikvm(12332): GC_FOR_ALLOC freed 223K, 3% free 9306K/9560K, paused 16ms, total 16ms
03-02 21:13:08.197: I/Adreno-EGL(12332): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
03-02 21:13:08.228: D/OpenGLRenderer(12332): Enabling debug mode 0
03-02 21:13:39.771: W/PopupManager(12432): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
03-02 21:13:39.891: D/dalvikvm(12432): GC_FOR_ALLOC freed 227K, 3% free 9303K/9560K, paused 17ms, total 17ms
Was it helpful?

Solution

This is the default behavior as per this issue.

The FAQ states:

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

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