I am doing a Android Studio Project with Firebase but I can't view the data in the Realtime Database. It seems successfully connected because I can see my data in the Authentication (User) but not displaying in Realtime database. Please help me. I have also turn the rules into true. But still my Firebase data showing south-masalaa-default-rtbd:null
mAuth.createUserWithEmailAndPassword(CustEmail, CustPass)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful())
{
User user = new User(CustName, CustEmail, CustPhoneNumber, CustPass );
FirebaseDatabase.getInstance().getReference("User")
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful())
{
Toast.makeText(SignUp.this, "Successful Registered", Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(SignUp.this, "Not successful", Toast.LENGTH_LONG).show();
}
}
});
} else
{
Toast.makeText(SignUp.this, "Failed to register the user", Toast.LENGTH_LONG).show();
}
}
});
You can specify the full database URL in the call to getInstance()
like this:
FirebaseDatabase.getInstance("your database URL").getReference()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.