I would like to create a leaderboard, which will display how many times user started the app. There should be all-time and weekly leaderboards. Let's say I count number of apps start locally and with each change submit incremented number:
Games.Leaderboards.submitScore(getApiClient(), LEADERBOARD_ID, 10);
But it will work for one week only - let's say user run the app for 10 times on week 1. Next week, once app is started, I will have to submit 11. It is OK for all-time leaderboard, but will not work for weekly leaderboard.
What should I do to achieve what I want?
The only idea I have is to have two different leaderboards:
Games.Leaderboards.submitScore(getApiClient(), WEEKLY_LEADERBOARD_ID, 1);
Games.Leaderboards.submitScore(getApiClient(), ALLTIME_LEADERBOARD_ID, 11);
But would it be possible to show weekly results only in WEEKLY_LEADERBOARD_ID and all-time results in ALLTIME_LEADERBOARD_ID? Would it be user friendly? Or, is there any other better option?
Two of the methods in the Leaderboards reference have a span parameter with the accepted values TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME. Mainly the functions loadTopScores and loadPlayerCenteredScores should be useful to you. You can find the full documentation here. It seems like you need to use two leaderboards because the scores are inherently different and load the scores based on your weekly/all time use cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With