This is my second question here. I am not 100% on the formatting and etiquette yet. I apologize in advance. I have a published app using the BaseGameUtils provided by Google. My achievements unlock properly, and the popups show properly, using incrementImmediate(parameters) with a result. However, the result, which I do receive, always comes back as STATUS_OK, even when the call results in unlocking the achievement. I can't manage to get result.getStatus().getStatusCode() to ever be STATUS_ACHIEVEMENT_UNLOCKED. Can anyone help?
Asked
Active
Viewed 242 times
0
-
Has anyone been able to get STATUS_ACHIEVEMENT_UNLOCKED as a status code for result??? – MrClicks Dec 04 '16 at 14:28
-
Anyone??????????? – MrClicks Jul 02 '17 at 22:49
1 Answers
0
Try to use the code given in this SO question, it will make your achievement increment by the amount of steps you want.
Games.Achievements.incrementImmediate(GoogleApiClient apiClient, String id, int numSteps).setResultCallback(new ResultCallback<Achievements.UpdateAchievementResult>() {
@Override
public void onResult(UpdateAchievementResult result) {
if (result.getStatus().getStatusCode() == GamesStatusCodes.STATUS_ACHIEVEMENT_UNLOCKED) {
}
}
});
The STATUS_ACHIEVEMENT_UNLOCKED
indicates that the incremental achievement was also unlocked when the call was made to increment the achievement.
You can also try to check this related SO question.
-
Thank you. However that is the EXACT code I found and am using when I encounter the problem. Could the problem be that the Achievement is not published? – MrClicks Nov 16 '16 at 11:48
-
You can refer to this [documentation](https://developers.google.com/games/services/android/achievements) and [this](https://developers.google.com/games/services/console/testpub#publishing_your_game_changes) about Publishing achievements. – KENdi Nov 17 '16 at 10:52
-
Thank you for your suggestions but I have poured through all that information before. I am using the exact code from the above referenced SO which the user states worked for them. Very frustrating! – MrClicks Nov 17 '16 at 12:16
-
Now that `Games.Achievements` is deprecated we have to use https://developers.google.com/android/reference/com/google/android/gms/games/AchievementsClient#incrementImmediate(java.lang.String,%20int) however for me the result of the task is always false, no matter the task is completed or not. Though, the documentation states "This form of the API will attempt to update the user's achievement on the server immediately. The Boolean in a successful response indicates whether the achievement is now unlocked." Any idea? – Martin Braun Oct 12 '18 at 12:05