In the GameHelper.java file there is a boolean attribute called mConnectOnStart that by default it is set to true. Just change it to false instead:
boolean mConnectOnStart = false;
Additionally, there is a method provided for managing this attribute from the outside of the class:
// Not recommended for general use. This method forces the "connect on start"
// flag to a given state. This may be useful when using GameHelper in a
// non-standard sign-in flow.
public void setConnectOnStart(boolean connectOnStart) {
debugLog("Forcing mConnectOnStart=" + connectOnStart);
mConnectOnStart = connectOnStart;
}
You can use the method above in order to customize your sign in process.
In my case, similar to you, I don't want to auto connect the very first time. But if the user was signed in before, I do want to auto connect. To make this possible, I changed the getGameHelper() method that is located in the BaseGameActivity class to this:
public GameHelper getGameHelper() {
if (mHelper == null) {
mHelper = new GameHelper(this, mRequestedClients);
mHelper.enableDebugLog(mDebugLog);
googlePlaySharedPref = getSharedPreferences("GOOGLE_PLAY",
Context.MODE_PRIVATE);
boolean wasSignedIn = googlePlaySharedPref.getBoolean("WAS_SIGNED_IN", false);
mHelper.setConnectOnStart(wasSignedIn);
}
return mHelper;
}
Every time, getGameHelper() method is called from onStart() in BaseGameActivity. In the code above, I just added the shared preference to keep if the user was signed in before. And called the setConnectOnStart() method according to that case.
Finally, don't forget to set the "WAS_SIGNED_IN" (or something else if you defined with different name) shared preference to true after user initiated sign in process. You can do this in the onSignInSucceeded() method in the BaseGameActivity class.
Hope this will help you. Good luck.