Firebase only works in Unity Editor and the pc does not work on Android

Asked

Viewed 61 times

0

Can anyone tell me, what’s going wrong? It only works in Unity Editor.
When buildo for android, does not work, but does not report any kind of error. While testing on 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");
            });
        });
    }

1 answer

0

I worked with sdk firebase and Unity recently, I had a lot of problems with it, in the editor it always worked right and when it gave build it did not go. After researching a lot I discovered that there is something in it that gives problem with the wifi. Try to restart the mold or use the 4g/3g cell phone to see if it works. If it doesn’t work try to give a force reolver in the playservices resolve and see if there are any errors. Give a check in Package name if it’s all right too. If there is still a problem specify more firebase packages that you are using to see if I can help in any way.

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

I honestly do not recommend using firebase with Unity, there are many problems even when it is stable the sdks will be perfect for a lot of things, I spent several months doing this and decided to change to web api itself, delayed the project but ta working perfectly now.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.