Jump to content

Fetch leaderboard entries with date limit


fredriksthlm
 Share

Recommended Posts

Hi,

I know every entry in the leaderboards are saved with a timestamp (since it is possible to delete entries made before a certain date with resetLeaderboards, and you can also call  getTimeStamp for a score).

But is it possible to fetch leaderboard data with date/timestamp limit?
Like to request "Highest of the month" or similar. So basically to use the normal getLeaderboardAsync function, but with a timestamp filter. That would be a good thing since we have this issue that players name will be changed into "Player" after 3months inactivity...

 

Link to comment
Share on other sites

3 hours ago, fredriksthlm said:

But is it possible to fetch leaderboard data with date/timestamp limit?
Like to request "Highest of the month" or similar. So basically to use the normal getLeaderboardAsync function, but with a timestamp filter. That would be a good thing since we have this issue that players name will be changed into "Player" after 3months inactivity...

It is possible, but it's perhaps a little "back-to-front" to what you describe?  There are a few approaches that can work (given the mid-2019 API):

  1. Create a new Leaderboard each month.  Use it for that month only - have your game connect to it using a naming convention that includes date / month.
  2. Use a single Leaderboard for all months.  Entirely reset that Leaderboard each month (or delete entries which are older than the current month's start date).
  3. Use a proprietary backend and synchronise Leaderboard entries.  This will theoretically allow you to filter limit and offset ranges on the getLeaderboardAsync method based on relative dates (complex and not entirely without other issues!).

For more information see:

https://developers.facebook.com/docs/games/instant-games/guides/using-leaderboards

In particular the references to the Facebook Graph APIs are what you need:

https://developers.facebook.com/docs/graph-api/reference/application/leaderboards_create/

https://developers.facebook.com/docs/graph-api/reference/application/leaderboards_reset/

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...