Firebase only works on Unity Editor and on pC does not work on Android

Can anyone tell me, what's going wrong? It works only in Unity Editor.
When buildo for android, it doesn't work, but it doesn't report any kind of error. When testing on the pc works normally.

public void CadastrarPorEmail()
    {
        email = _textEmail.text;
        password = _texSenha.text;


        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task =>
        {
            if (task.IsCanceled)
            {
                _imgDeAvisos.SetActive(true);
                _textAviso.text = "Erro ao criar usuário: " + task.Exception;
                Debug.LogWarning("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogWarning("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                _imgDeAvisos.SetActive(true);
                _textAviso.text = "Erro ao criar usuário: " + task.Exception;
                return;
            }

            // Firebase user has been created.
            Firebase.Auth.FirebaseUser newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})", newUser.DisplayName, newUser.UserId);
            _imgDeAvisos.SetActive(true);
            _imgDeAvisos.GetComponent<Image>().color = new Color32(0, 185, 156, 100);
            _textAviso.text = " Cadastro Criado com sucesso !" + newUser.DisplayName + newUser.UserId; 

            //Send Emails Verification
            newUser.SendEmailVerificationAsync().ContinueWith(t => {
            Debug.Log("Verifique o seu e-mail");
            });
        });
    }
Author: Denis Rudnei de Souza, 2018-11-09

1 answers

I worked with the firebase and unity sdk recently, I had a lot of problems with it, in the editor it always worked right and when I gave build I was not going. After researching a lot I found that there is something in it that da problem with wifi. Try restarting the moldem or use the 4G / 3G phone to see if it works. If it does not work try to give a force reolver in playservices resolve and see if there are any errors. From a checked in the package name if this is all right too. If there is still a problem specify more Firebase packages you are using to see if I can help in any way.

I had already logged in with facebook and logged in with google, accessed and recorded data in realtime database, everything was working, but I always had to change the mobile connection.

Honestly do not recommend ultilizar O firebase with Unity, has many problems even when it is stavel the sdks will be perfect for a lot of things, I lost several months doing this and decided to change to Web api own, delayed the project but ta working perfectly now.

 0
Author: Alan Bittencourt, 2019-11-20 15:44:29