androidfirebaseauthenticationregistrationdisplayname-attribute

Im Creating Registration with email and Password but with Fullname in Android Studio with Firebase


Im Creating Registration with email and Password but with Fullname of the user and display it when the users Login i try to find tutorials in youtube but no one provide or i dont just find it, only email and password tutorials ,

Anyone here could help me?

This is for Android Im using Android Studio my backend is Firebase

I want the user in the registration when click to the confirm button the Full name is will be registered to the firebase and display it in users profile..

thanks a lot.

By the way the code that I am using now is this

progressBar.setVisibility(View.VISIBLE);
            //create user
            auth.createUserWithEmailAndPassword(email, password)
                    .addOnCompleteListener(SignupActivity.this, new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            Toast.makeText(SignupActivity.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
                            progressBar.setVisibility(View.GONE);
                            // If sign in fails, display a message to the user. If sign in succeeds
                            // the auth state listener will be notified and logic to handle the
                            // signed in user can be handled in the listener.
                            if (!task.isSuccessful()) {
                                Toast.makeText(SignupActivity.this, "Authentication failed." + task.getException(),
                                        Toast.LENGTH_SHORT).show();
                            } else {
                                startActivity(new Intent(SignupActivity.this, MainActivity.class));
                                finish();
                            }
                        }
                    });

Solution

  • As you said you found tutorials with email and password. Follow those tutorials, the only thing extra you have to do is, make full name edit text in XML and during sign up check if it is not null and make users DB in the realtime database using UID.

     if (!emailAdd.equals("") || !pass.equals("") || (!name.eqauls(""){
    
                        mAuth.createUserWithEmailAndPassword(emailAdd, pass)
                                .addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                                    @Override
                                    public void onComplete(@NonNull Task<AuthResult> task) {
    
                                        if (task.isSuccessful()) {
    
                                            // Getting UID of Current User
                                            FirebaseUser current_user = mAuth.getCurrentUser();
                                            String UID = current_user.getUid();
    
    
    
                                            usersDB.child(UID).child("email").setValue(emailAdd);
                                            usersDB.child(UID).child("name").setValue(name);
    
                                Toast.makeText(youractivity.this, "Registeration done", Toast.LENGTH_SHORT).show();          
    
                                        } else {
    
                                            Toast.makeText(youractivity.this, "Registeration Failed", Toast.LENGTH_SHORT).show();
                                        }
                                    }
                                });
    
                    }