1

I am not seeing my XP awarded to the user. Here are the screenshots:

Here is the Achievements Page Here is the acheievments image

And here is the Leaderboard: 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);
}
}
AL.
  • 36,815
  • 10
  • 142
  • 281
superhuman
  • 47
  • 2
  • 12
  • According to [this SO thread](http://stackoverflow.com/questions/34409334/how-to-show-the-google-play-game-achievements?rq=1), have you already published your game in Google Play? If not, that might be the issue. Also, make sure you followed the [Achievements Android tutorial](https://developers.google.com/games/services/android/achievements#before_you_begin) in the docs. – ReyAnthonyRenacia May 29 '16 at 21:40
  • +noogui yeah I didn't publish the app I'm using the test version, will I be able to see xp after I publish the app? – superhuman May 30 '16 at 05:51
  • @noogui i am still not recieving xp on unlocking an achievement. – superhuman May 31 '16 at 08:00
  • Even if your app is in released state, this could be because you are using a) a test account which you have added to your developer console and b) you are using your developer account or c) just installed the apk not from Play store..... – Opiatefuchs Jul 04 '17 at 07:00

0 Answers0