Serhii K.
Serhii K.

Reputation: 679

AchievementsClient doesn't show unlock popup

I have the following code in my BaseActivity onCreate()

// Google Play Services
        mGoogleSignInClient = GoogleSignIn.getClient(this, new GoogleSignInOptions
                .Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
                .build());

Then I call this in subclass

startActivityForResult(mGoogleSignInClient.getSignInIntent(), RC_SIGN_IN);

I use the following code to unlock an achievement

 GoogleSignInAccount googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity);

        if (googleSignInAccount != null) {
            Games.getAchievementsClient(activity, googleSignInAccount)
                    .unlockImmediate(id);
        }

It works but I can't see any "Achievement has been unlocked" popups.

Upvotes: 2

Views: 398

Answers (1)

Serhii K.
Serhii K.

Reputation: 679

This code solved my problem

  Games.getGamesClient(activity, googleSignInAccount).setViewForPopups(popupView);

Upvotes: 3

Related Questions