Search code examples
androidxamaringoogle-play-servicesgoogle-play-games

How to get number of pending matches with Google Play


What is the best way to get the number of pending matches with Google Player Game Services?

I am currently thinking of loading all current matches, filtered by ones that are a) currently my turn pending or b) have an invitation for my pending.

The only way I see to do this, is by using loadMatchesByStatus, but this seems like major overkill, as it will async load all the match data, but all I care about is the number of matches (I don't actually need any of the match data).

Are you aware of anything in the API to provide me with a way to find the number of pending games, without loading all of the game data?

Thanks!


Solution

  • Currently there is no way to load the 'count' of the matches without loading the rest of the match metadata.

    I assume you are using this for some kind of notification badge/alert. If you are really concerned about performance you could just keep track of this counter locally. For example increment it whenever you get a turn notification, decrement it when you take a turn, etc.