Google Play Game Service - Cannot unlock Achievements

android, google-play-games, google-play-services

Solution

The code for unlocking an achievement is as follows:

Games.Achievements.unlock(getApiClient(), "your_achievement_id");

Here the achievement id is the id you get while creating achievement in Google Game Services.

That is in Google developer Console->Game Services->Your Application->Achievement

Hope this will help you..

Problem

I have implemented Google Play Game Service into my game by referring to the quick start given by Google. I have added the achievement ids in my 'id.xml' file. My game has around 10 achievements. The code to unlock my achievements is as follows: ``` Games.Achievements.unlock(getApiClient(), "achievement_1_0"); ``` where 'achievement_1_0' is the string name of one of my achievements. My issue is that non of my achievements are getting unlocked, even when the conditions are correct. After viewing my log, I got this `E/AchievementAgent(13528): Couldn't find local achievement to update for achievement ID achievement_1_0` from the session filter `com.google.android.gms(Session Filter)` Any thoughts on what might have gone wrong? or is it a bug ..???

Original source