When a user receives, and taps, on a turn based notification the default UI pops up allowing them to select which turn/invite to proceed with. This then launches my game.
However I cannot figure out how to determine which turn/invite the user selected and load the respective match automatically.
At the moment I am forced to reshow the default match inbox UI and react to the intent from it.
I have this
TurnBasedMatch aMatch = getGameHelper().getTurnBasedMatch();
if (aMatch != null) {
// GameHelper will cache any connection hint it gets. In this case,
// it can cache a TurnBasedMatch that it got from choosing a
// turn-based
// game notification. If that's the case, you should go straight
// into
// the game.
updateMatch(aMatch);
return;
}
in my main activity, and I just found it in the sample SkeletonActivity where I must have copied it from. The idea is that as your main activity is launched, if you've used the standard BaseGameActivity base class, it authenticates and logs in automatically, and once it signs in, the Game Helper instance is able to retrieve the Match from whatever externally induced intent or hint available.
This GameHelper class is part of the BaseGameUtils "library" that the quick start guide suggests to use. This GameHelper gets the match from the Bundle provided in onConnected() of the Client library.
TurnBasedMatch match = connectionHint
.getParcelable(GamesClient.EXTRA_TURN_BASED_MATCH);