简体   繁体   中英

Google Play Games achievement result status code is always STATUS_OK

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM