I am trying to implement an online leaderboard for the newest version of my app. I followed the tutorial found here:
http://swarmconnect.com/admin/docs/leaderboard
Here is relevant code from MainMenu.java
.
public void onCreate(Bundle savedInstanceState) {
// if user has logged in before, automatically login user without showing the home screen
if(Swarm.isEnabled()) {
autoLogin();
} else {
login();
}
if(Swarm.isEnabled() == false) {
autoLogin();
}
}
public void autoLogin() {
Swarm.init(MainMenu.this, ...., "...");
}
public void login() {
Swarm.init(MainMenu.this, ..., "...");
}
}
Results.java
displays after the quiz is over. Here is the relevant code in there:
public void submitScore(long score) {
SwarmLeaderboard.submitScore(LEADERBOARD_ID, score);
}
Here is relevant code from Highscores.java
:
public void showLeaderboard() {
SwarmLeaderboard.showLeaderboard(LEADERBOARD_ID);
}
That is all the code I have and that is all that was on the SwarmConnect website. I am able to login from the MainMenu
successfully and the app never crashes. But when I go to Highscores.java
nothing is displayed. There has to be more code but I don't see any docs anywhere for instructions past the ones in the link at the top.
My question is how to display the scores that were submitted from the Results.java
page.
Okay, I have SwarmConnect on a simple game I made.
Here's the code I used to show LeaderBoards: Swarm.showLeaderboards();
It was Swarm
and not SwarmLeaderboard
.