How to use Firebase

Asked

Viewed 65 times

1

Guys, I need to use firebase for my technical TCC, however, I always used sqlserver even, I’m used to the SQL language. Could someone give me a basis of how I can for example create a user table with phone name etc? type, the modeling itself, I could not do anything but the connection with android and the registration and login with email, it was smooth, I saw a tutorial, but other than that, I got nothing.

1 answer

0


To make your life easier, advice create a class to easily catch the instance:

My firebase class:

    public final class ConfiguracaoFirebase {

        private static DatabaseReference referenciaFireBase;
        private static FirebaseAuth auth;

        public static DatabaseReference getFirebase() {

            if(referenciaFireBase == null)
             referenciaFireBase  = FirebaseDatabase.getInstance().getReference();

            return referenciaFireBase;
        }

        public static FirebaseAuth getAutenticacao()
        {
            if(auth == null)
                auth = FirebaseAuth.getInstance();
            return auth;
        }
    }


    public class MainActivity{

            private DatabaseReference mUsuarioDb; 

           protected void onCreate(Bundle savedInstanceState) {
                   super.onCreate(savedInstanceState);


               // criando tabela
                mUsuarioDb = ConfiguracaoFirebase.getFirebase().child("usuario");

                mUsuarioDb.child("nome").setValue("usuarioNome");
                mUsuarioDb.child("telefone").setValue("usuarioTel");
           }
    }

I’m doing a project all in firebase, follow the project link, can use the will:
github.com/jony5ds/whats_app_clone

  • 1

    Thanks, I’ll take a look :)

  • Any doubt just talk, I’m working on a project with firebase, I believe this project can help you a lot

Browser other questions tagged

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