I am not seeing my XP awarded to the user. Here are the screenshots:
Here is the Achievements Page
And here is the Leaderboard:
Here is my code for the calling of achievements and leaderboards from google play services:-
protected static final int REQUEST_LEADERBOARD = 1;
protected static final int REQUEST_ACHIEVEMENTS = 0;
@Override
public void onClick(View v) {
if (v.getId() == R.id.scoreButton)
{
counter++;
giveAchievements(counter);
textScore.setText(""+counter);
}
if(v.getId() == R.id.show_achievements)
{
startActivityForResult(Games.Achievements.getAchievementsIntent(getApiClient()), REQUEST_ACHIEVEMENTS);
}
if(v.getId() == R.id.show_leaderboard){
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getApiClient(),
getString(R.string.leaderboard_leaderboard)), REQUEST_LEADERBOARD);
}
if (v.getId() == R.id.share)
{
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
if (v.getId() == R.id.sign_in_button) {
beginUserInitiatedSignIn();
}
else if (v.getId() == R.id.sign_out_button) {
signOut();
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_button).setVisibility(View.GONE);
}
}
And here is the code which unlocks achievements but it does not award any xp to the user as you can see in above image 2 i want to give users xp when they attain a certain 'counter' score:-
void giveAchievements(int counter)
{
if (counter == 10)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_first_10_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), "CgkI-eXOwZsFEAIQBg", counter);
}
if (counter == 50)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_50_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), "CgkI-eXOwZsFEAIQBg", counter);
} if (counter == 100)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_100_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), getString(R.string.leaderboard_leaderboard), counter);
} if (counter == 250)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_250_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), "CgkI-eXOwZsFEAIQBg", counter);
} if (counter == 500)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_500_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), getString(R.string.leaderboard_leaderboard), counter);
} if (counter == 1000)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_1000_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), getString(R.string.leaderboard_leaderboard), counter);
} if (counter == 1500)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_1500_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), getString(R.string.leaderboard_leaderboard), counter);
} if (counter == 3000)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_3000_clicks));
Games.Leaderboards.submitScoreImmediate(getApiClient(), getString(R.string.leaderboard_leaderboard), counter);
} if (counter == 5000)
{ if(getApiClient().isConnected())
Games.Achievements.unlock(getApiClient(),
getString(R.string.achievement_5000_clicks));
Games.Leaderboards.submitScore(getApiClient(), getString(R.string.leaderboard_leaderboard), counter);
}
}