Open magabriel opened 9 years ago
@magabriel, I was facing this exact problem and solved it by modifying the method onActivityResult on GooglePlayGame.java. This way, if the activity exiting is the one we started with the ID ACTIVITY_CODE_SHOW_LEADERBOARD (the leaderboard) and the result is that a reconnection is required (due to an inconsistent state on the api client), we force a disconnect. This can be extended to take into account the achievements view, by adding an OR with the constant ACTIVITY_CODE_SHOW_ACHIEVEMENTS.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == ACTIVITY_CODE_SHOW_LEADERBOARD
&& resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) {
Log.d(LOGTAG, "Disconnection from Play Services called from activity with code: " + requestCode);
gameHelper.disconnect();
} else {
gameHelper.onActivityResult(requestCode, resultCode, intent);
}
}
What do you think @ptgamr ?
Hi, everyone.
I implemented this plugin in my app and reached the following scenario:
googleplaygame.isSignedIn()
--> result isfalse
googleplaygame.auth()
--> OK, UI messages are shown indicating that user has been signed in.googleplaygame.showAllLeaderboards()
--> OK, "Leaderboards" diaglog is shown.googleplaygame.isSignedIn()
--> result istrue
(but must befalse
)It seems that the return of
isSignedIn()
does not correctly reflect the real status.After that, subsequent calls to
googleplaygame.showAllLeaderboards()
break the app with the exceptionjava.lang.SecurityException: Not signed in when calling API
instead of just calling the error callback provided.Thanks,