I did exactly same thing that in google docs for Play Games Services Sign In v2. But whenever run my project in android studio,"isAuthenticated" variable is always set as "false". I find isAuthenticatedTask.isSuccessful() returns "true". But (isAuthenticatedTask.getResult().isAuthenticated()) returns "false" so "isAuthenticated" variable is going to be set as "false". That means I cannot sign in google play games. I used exact same code that provided by Google. Of course I did prerequests in the google docs. Sample code in my project:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Play Games Services
PlayGamesSdk.initialize(this);
GamesSignInClient gamesSignInClient = PlayGames.getGamesSignInClient(MainActivity.this);
gamesSignInClient.isAuthenticated().addOnCompleteListener(isAuthenticatedTask -> {
boolean isAuthenticated =
(isAuthenticatedTask.isSuccessful() &&
isAuthenticatedTask.getResult().isAuthenticated());
if (isAuthenticated) {
// Continue with Play Games Services
Toast.makeText(MainActivity.this, "Succesful!", Toast.LENGTH_SHORT).show();
} else {
// Disable your integration with Play Games Services or show a
// login button to ask players to sign-in. Clicking it should
// call GamesSignInClient.signIn().
Toast.makeText(MainActivity.this, "Failed!", Toast.LENGTH_SHORT).show();
}
});
///
}
It toasts (messages) "Fail!" always. I tried calling gamesSignInClient.signIn()
on a button or inside "else". Nothing happened. There are some kind of logs that can be related to this. These:
W/GooglePlayServicesUtil: Google Play services out of date for "MYPROJECT". Requires 213000000 but found 202414023
W/GoogleApiManager: The service for com.google.android.gms.internal.games_v2.zzx is not available: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
Also I don't know why, Android Studio logs so many (maybe 50 times) of this in red color:
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
So, I tried almost everything. I did everything that in Google Play Console as well. Like, OAuth stuff. Publishing OAuth Consent, creating OAuth credentials and adding Project ID to games-ids.xml, even in strings.xml. Of course I created OAuth credential with my project SHA-1 signature. Why can't I sign in?
After this failure, I decided to implement Play Games Services v1 (Older One). I tried like explained in https://developers.google.com/games/services/v1/android/signin website (google docs). But I didn't understand some explanations on it. Is there some kind of guide that is more explanative out there? Thanks!
Ok,
So I have the same problem, looking all over the internet and at last solve the issue.
Fill the Oauth Consent Screen https://console.cloud.google.com/apis/credentials/consent and add a tester account, your gmail account you are using to test.
I don't know if it works for you, but it worked for me.