0

I have made a gaming app, and published it on google store and I have added google achievement xp to my app, but there is no guide on internet that I can find that should add player's earned xp on the google play game profile and also it(google game app) not showing achievements and xp it only shows the leaderboard.

Here is my code :-

void giveAchievements(int counter) {
if (counter == 10) {   
    int xp = getXp();
    xp += 500;
    saveXp(xp);
    if(getApiClient().isConnected()) {
        Games.Achievements.unlock(getApiClient(),   getString(R.string.achievement_first_10_clicks));   
        Games.Leaderboards.submitScoreImmediate(getApiClient(), "CgkI-    eXOwZsFEAIQBg", counter);
    }
}
}

private int getXp() {
SharedPreferences sharedPref =   PreferenceManager.getDefaultSharedPreferences(this);
return sharedPref.getInt("xp", 0);
}

private void saveXp(int xp) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt("xp", xp);
editor.apply();
}

Here is the image of achievements inside my appimage of achievements

And here in the google play profile the xp doesn't add to the profile and also here the app's achievements section is not showing:- Game profile that don't contain xp additions and achievements

superhuman
  • 47
  • 2
  • 12

1 Answers1

0

Try to call getAchievementsIntent() as stated in the GPGS Displaying Achievements guide. That's the Android guide written by Google.

startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient),
REQUEST_ACHIEVEMENTS);

Also try to check if this SO thread might be of help.

In the Google Play Games Github sample, it is invoked like this:

public void onShowAchievementsRequested() {
        if (isSignedIn()) {
            startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient),
                    RC_UNUSED);
        } else {
            BaseGameUtils.makeSimpleDialog(this, getString(R.string.achievements_not_available)).show();
        }
}
Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • but this doesn't work i m still not seeing my games achievements on 'google game' app and also the player's xp part is the most important part, the xp of the current player is not updating can you provide a clear on this part where i can add my game's xp to the current user's xp and level the user up! – superhuman Jun 03 '16 at 09:43
  • no its still not showing achievements, leaderboard and xp history of my app but these are present inside my app but they don't add up to my google game profile! – superhuman Jun 03 '16 at 12:29