I've looked all over the web for this one and I couldn't find anything, what am facing here is that whenever I try to unlock an achievement via the code:
Games.achievements.unlock(getApiClient(), "id");
the damn thing won't unlock ! and I have published my app on the play games and its live, the hash keys are sure to be correct because it logs into the play games, I've checked the key hash for each achievements and nothing is wrong there either, I started pulling my hair after trying:
Games.achievements.unlockImmediate();
So I came running to you guys :)
When you use unlockImmediate()
, you can set a listener to check for the outcome of unlocking an achievement.
Use this code:
Games.Achievements.unlockImmediate(getApiClient(), "id").setResultCallback(new ResultCallback<UpdateAchievementResult>() {
@Override
public void onResult(UpdateAchievementResult res) {
System.out.println(res.getStatus().getStatusCode());
}
});
This will unlock the achievement, then give you a status code to tell you the result. Check the code you get against this list of codes. It should be STATUS_OK which has a status code of 0. If it isn't, you can check what it returned to see why it went wrong.
Good Luck.