UPDATED Description
How can send the user to the database at the same time as a user signup. Worked in my old code but not anymore, what am I missing?
It gets connection with the database when the user is logged in and when i start my geo tagging of the user in mainActivy(). But I need it to be saved immediately when the user sigs up and gets logged in. So something with the code is wrong in my login activity.
Login Activity:
mAuthListener = new FirebaseAuth.AuthStateListener() {
    @Override
    public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
        FirebaseUser user = firebaseAuth.getCurrentUser();
        if (user != null) {
            // User is signed in
            Log.d("TAG", "onAuthStateChanged:signed_in:" + user.getUid());
            DatabaseReference ref = FirebaseDatabase.getInstance().getReference(); 
            // Authenticated successfully with authData
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("email", email);
            ref.child("users").child(user.getUid()).updateChildren(map);  
            Intent intent = new Intent(LoginActivity.this, MainReal.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(intent);
        } else {
            // User is signed out
            Log.d("TAG", "onAuthStateChanged:signed_out");
        }
    }
};
Dependencies
compile "com.google.firebase:firebase-database:9.0.0"
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.firebaseui:firebase-ui-auth:0.4.0'
