Question

Currently we open Achievements View with

startActivityForResult(mHelper.getGamesClient().getAchievementsIntent(), REQUEST_ACHIEVEMENTS);

Can we get some kind of callback when achievements view was closed? Or if it is possible - to get a callback when user Exits GPG within the achievements view. GameHelper's "onDisconnected()" is not firing for some reason - when that happens. I've googled this - but found nothing

Edit: should i look for some specific responseCode inside onActivityResult ?

Was it helpful?

Solution

Declare this variable and this method in your class.

private static int achievementsIntent = 10001;


protected void onActivityResult(int requestCode, int resultCode, Intent data) {

  if (requestCode == achievementsIntent) {
     //you are in your callback
     if (resultCode == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED) {
         // user logged out from achievements screen
     } 
  }
}

Then call your achievements intent:

startActivityForResult(Games.Achievements.getAchievementsIntent(GoogleApiClient), achievementsIntent);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top