I am trying to pass data from androidX to Firebase, it was working perfectly but now it doesn’t work. I am attaching screenshots for the better understanding.
private FirebaseDatabase database = FirebaseDatabase.getInstance();
private DatabaseReference myRef = database.getReference().child("Users");
Main activity:
More annoying screenshots of text:
Also I try it with URL inside the getInstance()
function
but that doesn’t work, either.
private FirebaseDatabase database = FirebaseDatabase.getInstance("URL");
private DatabaseReference myRef = database.getReference().child("Users");
2
Answers
Path is needed.
Like this:
When
FirebaseDatabase.getInstance()
does require an URL, this means that you have to runFirebaseApp.initializeApp(MainActivity.this)
first, in order to initialize theFirebaseApp
… unless wanting to connect to another RTDB URL.