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.
However, it always returns false, even when the achievement becomes unlocked. This is my code:
boolean result = false;
boolean unlocked = false;
// In a function:
Games.getAchievementsClient(GoogleSignIn.getLastSignedInAccount(this)).incrementImmediate("123456789", 1).addOnCompleteListener(new OnCompleteListener<Boolean>() {
@Override
public void onComplete(@NonNull Task<Boolean> task) {
if(task.isSuccessful()) {
result = true;
unlocked = task.getResult(); // BUG: This is always false, even when the achievement is unlocked now
} else {
result = false;
unlocked = false;
Exception ex = task.getException();
Log.d(TAG, "Failed to increment achievement progress: " + (ex != null ? ex.getMessage() : "UNKNOWN"));
}
}
});
Hi,
I've spotted a bug in AchievementsClient.incrementImmediate.
The documentation states:
However, it always returns false, even when the achievement becomes unlocked. This is my code: