I am having trouble since 2 days ago and I can't find any solution.
I have two buttons, one for signin and another one for signout. If the user is signed in I show the signout button and ıf the user is not signed in then I show the signin button.
The problem starts here; When the user clicks on sign in button I hide the signin button and show the signout button and set its text to "connecting.." if signin flow succeeded I would want to change the text to "signout". If flow fails I hide the signout and show sign in button again. The problem is the text of the signout button remains as "connecting.." even if sign in flow succeeded.
Here is my code: (My class doesn't extends to BaseGameActivity)
mHelper = new GameHelper(this, GameHelper.CLIENT_ALL);
GameHelper.GameHelperListener listener = new GameHelper.GameHelperListener() {
@Override
public void onSignInSucceeded() {
signin.setVisibility(View.GONE);
signout.setVisibility(View.VISIBLE);
signout.setText(R.string.signout);
}
@Override
public void onSignInFailed() {
signout.setVisibility(View.GONE);
signin.setVisibility(View.VISIBLE);
}
};mHelper.setup(listener);
and the click listener:
case R.id.sign_in_button:
signout.setText(R.string.loading);
signout.setVisibility(View.VISIBLE);
mHelper.beginUserInitiatedSignIn();
signin.setVisibility(View.GONE);
break;
case R.id.sign_out_button:
mHelper.signOut();
signin.setVisibility(View.VISIBLE);
signout.setVisibility(View.GONE);
break;
Update :
Signin and signout process works, because I can submit score to leaderboard and display it.