AchievementsClient 不显示解锁弹出窗口
AchievementsClient doesn't show unlock popup
我的 BaseActivity onCreate()
中有以下代码
// Google Play Services
mGoogleSignInClient = GoogleSignIn.getClient(this, new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.build());
然后我在子类中调用这个
startActivityForResult(mGoogleSignInClient.getSignInIntent(), RC_SIGN_IN);
我使用下面的代码来解锁一个成就
GoogleSignInAccount googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity);
if (googleSignInAccount != null) {
Games.getAchievementsClient(activity, googleSignInAccount)
.unlockImmediate(id);
}
有效,但我看不到任何 "Achievement has been unlocked" 弹出窗口。
这段代码解决了我的问题
Games.getGamesClient(activity, googleSignInAccount).setViewForPopups(popupView);
我的 BaseActivity onCreate()
中有以下代码// Google Play Services
mGoogleSignInClient = GoogleSignIn.getClient(this, new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.build());
然后我在子类中调用这个
startActivityForResult(mGoogleSignInClient.getSignInIntent(), RC_SIGN_IN);
我使用下面的代码来解锁一个成就
GoogleSignInAccount googleSignInAccount = GoogleSignIn.getLastSignedInAccount(activity);
if (googleSignInAccount != null) {
Games.getAchievementsClient(activity, googleSignInAccount)
.unlockImmediate(id);
}
有效,但我看不到任何 "Achievement has been unlocked" 弹出窗口。
这段代码解决了我的问题
Games.getGamesClient(activity, googleSignInAccount).setViewForPopups(popupView);