Here is a method I use to increment a google play services leaderboard. If the score returned is null, score of 1 is posted. Otherwise, current score is incremented by 1. This is useful for keeping track of daily scores, for example. Note the use of TIME_SPAN_DAILY to indicate the time span desired. This will retrieve the highest score posted for the day, assuming "Higher is better" was indicated when setting up the leaderboard.
private void incrementDailyLeaderboard(final LeaderboardsClient leaderboardsClient, final String leaderboardId) {
leaderboardsClient.loadCurrentPlayerLeaderboardScore(
leaderboardId,
LeaderboardVariant.TIME_SPAN_DAILY,
LeaderboardVariant.COLLECTION_PUBLIC
).addOnSuccessListener(this, new OnSuccessListener<AnnotatedData<LeaderboardScore>>(){
@Override
public void onSuccess(AnnotatedData<LeaderboardScore> leaderboardScoreAnnotatedData) {
//Log.v("onSuccess","onSuccess");
if (leaderboardScoreAnnotatedData != null) {
long score = 0;
if (leaderboardScoreAnnotatedData.get() != null) {
score = leaderboardScoreAnnotatedData.get().getRawScore();
//Log.v("Your score is", Long.toString(score));
}
leaderboardsClient.submitScore(leaderboardId, ++score);
}
}
});
}