I am using Google Play services to set up achievements for an android game.
Goal:
In my onAchievmentUnlocked
callback I want to send a noti
Use this code here:
Games.Achievements.incrementImmediate(GoogleApiClient apiClient, String id, int numSteps)
.setResultCallback(new ResultCallback<Achievements.UpdateAchievementResult>() {
@Override
public void onResult(UpdateAchievementResult result) {
switch (result.getStatus().getStatusCode()) {
case GamesStatusCodes.STATUS_ACHIEVEMENT_UNLOCKED:
// the state of the achievement is STATE_UNLOCKED after an increment operation. Continuing to increment an already unlocked achievement will always return this status.
break;
case GamesStatusCodes.STATUS_ACHIEVEMENT_UNKNOWN:
// the achievement failed to update because could not find the achievement to update.
break;
case GamesStatusCodes.STATUS_ACHIEVEMENT_NOT_INCREMENTAL:
// achievement failed to increment since it is not an incremental achievement.
break;
case GamesStatusCodes.STATUS_ACHIEVEMENT_UNLOCK_FAILURE:
// the call to unlock achievement failed.
break;
}
}
});
This code will increment an achievement by how many ever steps you want, and then will call onResult to see the status of your achievement that was incremented.
Here is a link to see more possible statuses: https://developer.android.com/reference/com/google/android/gms/games/achievement/Achievements.UpdateAchievementResult.html