I am developing a game where you should automatically connect to Google Play Games if you are signed in on your phone. However, when starting the app it tries to login and a "loading wheel" comes up for a few seconds. Then it shuts down and nothing happens, it failed to connect.
In Unity I have a keystore where I obtain a SHA-1 certificate. This is the same which is found in Google Play Console under app signing and Upload Key Certificate. Then in API OAuth and Credentials I have a Production keystore where I put in the same SHA-1 certificate, which it tells you to do.
In Unity on start up I use the following code to authenticate:
void Awake()
{
// Set up the Play Service Configuration
ClientConfiguration = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(ClientConfiguration);
PlayGamesPlatform.Activate();
// Authenticate the player and log into Play Games
DoAuthenticate(SignInInteractivity.CanPromptAlways);
}
internal void DoAuthenticate(SignInInteractivity interactivity)
{
PlayGamesPlatform.Instance.Authenticate(interactivity, (code) =>
{
if (code == SignInStatus.Success)
{
//Debug.Log("Authenticated. Hello, " + Social.localUser.userName + " (" + Social.localUser.id + ")");
isAuthenticated = true;
}
else
{
//Debug.Log("*** Failed to authenticate with " + code);
isAuthenticated = false;
}
});
}
Everything works fine when in debug mode and installing phone locally on the phone. Why is it not working when released to Play Store? Am I missing something?