Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Crash when i call Authenticate #165

Open
sabriboughanmi opened this issue Nov 9, 2017 · 0 comments
Open

App Crash when i call Authenticate #165

sabriboughanmi opened this issue Nov 9, 2017 · 0 comments

Comments

@sabriboughanmi
Copy link

sabriboughanmi commented Nov 9, 2017

Hello Guys,

My app is crashing in when i call Social.localUser.Authenticate((bool success) ..
but when i comment these .RequestEmail() .RequestServerAuthCode(false) my app work correctly but i receive the Email of the user as Empty String.

Thanks for your Help in advance.

This is my Full Code:

`using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
using TMPro;

using UnityEngine;

public class GooglePlayLogin : MonoBehaviour {

public TextMeshProUGUI TextDebug,DebugEmail;


void Start () {
     PlayGamesConfig();


}


private void Update()
{
   //  Im testing in Update to get the Email
    if(DebugEmail.text == null || DebugEmail.text == "" )
    {
        GetUserInfo();
    }
    
}

private void PlayGamesConfig()
{

    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()

        .RequestEmail()
        .RequestServerAuthCode(false)
         
        .Build();
    

    PlayGamesPlatform.InitializeInstance(config);

   
    // recommended for debugging:
    PlayGamesPlatform.DebugLogEnabled = false;

    // Activate the Google Play Games platform
     PlayGamesPlatform.Activate();
}
public void GooglePlayGamesLogin()
{


        Social.localUser.Authenticate((bool success) =>
        {
            if (success)
            {
                TextDebug.text = success.ToString();
                GooglePlayGames.OurUtils.PlayGamesHelperObject.RunOnGameThread(
                       () => {
                           TextDebug.text += ((PlayGamesLocalUser)Social.localUser).Email ;
                           TextDebug.text += PlayGamesPlatform.Instance.GetServerAuthCode();
                       });


            }
            else
            {
                // handle success or failure
                TextDebug.text = success.ToString();
            }
        });

}

public void GetUserInfo()
{

    DebugEmail.text += ((PlayGamesLocalUser)Social.localUser).Email;
    DebugEmail.text += PlayGamesPlatform.Instance.GetUserEmail();

}


public void UserSignOut()
{
    PlayGamesPlatform.Instance.SignOut();
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant