I think you should check:
GoogleSignIn.hasPermissions(account, Games.SCOPE_GAMES_LITE).
And if there is no permissions in that account you should use
GoogleSignIn.getClient(this, gso).silentSignIn or GoogleSignIn.getClient(this, gso).getSignInIntent()
with startActivityForResult to receive account with GAMES_LITE scope.
GoogleSignIn.hasPermissions also returns false for null account which could be also result of the getLastSignedInAccount.
Example:
GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this);
if (GoogleSignIn.hasPermissions(account, Games.SCOPE_GAMES_LITE)) {
onSignIn(account);
} else {
signInClient
.silentSignIn()
.addOnCompleteListener(
this,
task -> {
if (task.isSuccessful()) {
onSignIn(task.getResult());
} else {
resetSignedIn();
}
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…