getTopNRankers with offset

0 votes
How i can request leaderborad rankers with offset? 
 
for example  my game has 1000 players and i want show them all, but 10 per page.
 
For now i can only show 10 first players with score: 
  1. int max = 10;
  2. Game game = scoreboardService.getTopNRankers(gameName,  max);
maybe i  miss some paging method?
 
asked Dec 25, 2014 in App42 Cloud API-BaaS by gemobile.team (26 points)

1 Answer

+1 vote
 
Best answer

Hello GeoMobile,

For getting the rankers with offset in leaderboard, you need to specify the offset in leaderbord call.  For your convenience, I have added the code snippet:

String gameName = "<Enter_your_game_name>";

int max = 10;

 
scoreBoardService.setPageOffset(0); // Next page your offset will be 11 and so on.

Game game = scoreBoardService.getTopNRankers(gameName,max); 

System.out.println("Game Name is : "+game.getName());

for(int i = 0;i<game.getScoreList().size();i++)

{

System.out.println("userName is : " + game.getScoreList().get(i).getUserName());

System.out.println("score is : " + game.getScoreList().get(i).getValue());

System.out.println("Created On is  :"+game.getScoreList().get(i).getCreatedOn());

System.out.println("scoreId is : " + game.getScoreList().get(i).getScoreId());

}

Let us know if it helps.

Himanshu Sharma

answered Dec 26, 2014 by hs00105 (2,005 points)
edited May 18, 2015 by hs00105
yes, thank you.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...