'Problem connecting my unity App to Amazon aws rds

i made a straightforward App in unity with the objective to learn both how to make apps in unity and upload the data from the app to an amazon database,right now the app opens and presents you with a choice of language and a selector for a country and then it just shows an empty view saying data inserted .

What the code does is query the AWS rds MySQL database and see if the device is already in the database, if it is it does an update query if it isn't it inserts the new user and the selection .The id is taken from player preferences. Right now it all works in unity 2019 it inserts the data and updates it no problem when i press the play button and do the test and i can see the changes in the database with MYSQL workbench.

The problem is when i test it in my phone or in virtual devices with android studio it just get stuck loading and doesn't do anything and i cant find the reason why .

Now i understand that i should do an API REST service to act in the middle to protect the data etc .. and i will do it in the future but right now i just want to do simple querys and learn to use the enviroment before doing more .

the debug shows me it just stops here in the ckeck to see if its connected The error

public int UsuarioRegistrado(string userid)
    {
        MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
        builder.Server = Host;
        builder.UserID = User;
        builder.Password = Password;
        builder.Database = Database;
        string sql;
        int id = 0;
        Debug.Log("intento conectarme desde check usuario registrado ");
        try
        {
            using (MySqlConnection connection = new MySqlConnection(builder.ToString()))
            {
                connection.Open();
                Debug.Log("Me conecto ");
                sql = "SELECT COUNT(*) FROM usuarios where  ID_TOKEN  = '" + userid + "';";

                MySqlCommand comando = new MySqlCommand(sql, connection);
                var output = comando.ExecuteScalar();
                id = int.Parse(output.ToString());
                connection.Close();

            }
        }
        catch (MySqlException exception)
        {
            print(exception.Message);
        }
        return id;
    }

and this is where I am calling it

private IEnumerator SignUpCoroutine(User user)
    {
        // Ocultar botón de continuar y mostrar icono de carga.
        ShowContinueButton(false);
        ShowLoadingIcon(true);
        Debug.Log("Compruebo si el usuario esta registrado ");
        // Lanzar registro.
        string userId = PlayerPreferences.GetString(Preference.UUID);
        int test = 0;
        // por defecto devuelve 0 si esta registrado devuelve 1 
        if (DatabaseAPI.Instance.UsuarioRegistrado(userId) == 0)
        {
            // lo registro si no lo esta 
            DatabaseAPI.Instance.InsertarUsuario(user);
            Debug.Log("registro el usuario desde el controller ");
            test = 1;

        }
        if (DatabaseAPI.Instance.UsuarioRegistrado(userId) != 0) {

            Debug.Log("Usuario ya registrado  ");
            test = 1;
        }

            // Esperar respuesta.
            yield return new WaitUntil(() => test ==1);
        // Finalizar estado (transitar a CheckSupportState)
        SetViewActive(false);
        state.End();
    }

if you guys could help me i would appreciate it .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source