Play games loadLeaderboardMetadata() returns outda

2020-04-08 12:38发布

问题:

I'm working on an app with Play Game Services, and I'm making a custom UI to display the list of leaderboards with only the score and the ranking of the player as dynamic data.

Then, when the user clicks on the score or ranking, he will be taken to the leaderboard default UI to display this particular leaderboard in details.

In other words: I'm making a custom UI for leadeboards list, but I use default UI for displaying a specific leaderboard.

I use loadLeaderboardMetadata() method to get the leaderboards data. The problem is it returns outdated data, even when I use loadLeaderboardMetadata(context, true) to force the reloading of data.

Moreover, if I click on an outdated score to display a specific leaderboard with the default UI, the data here is up to date ! ... and then, if I go back to my list of leaderboards and force the data reload, then the data for this specific leaderboard will be up to date (but not the data for other leaderboards).

Any idea and/or ways to work around that?

Thank you in advance,

Stéphane.

回答1:

I finally found that by using the loadCurrentPlayerLeaderboardScore instead of the loadLeaderboardMetadata method, it seems to work.

Update: Except that this method is really slow if you have 30 leaderboards, and it throws error because you make to much call to the API's, so it is not a viable option. Except if you have very few leaderboards.