Skip to content Skip to sidebar Skip to footer

Firebase Realtimedatabase Is Not Working Now?

Now Firebase RealtimeDatabase 'write' is now working. Here is the firebase sample code. FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference myRef

Solution 1:

Try to put OnComplete Listener, is it called?

myRef.setValue("Hello, World!", newDatabaseReference.CompletionListener() {
  @OverridepublicvoidonComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
    if (databaseError != null) {
        Log.d("saving","Data could not be saved " + databaseError.getMessage());
    } else {
        Log.d("saving","Data saved successfully.");
    }
  }
}).addOnFailureListener(newOnFailureListener() {
    @OverridepublicvoidonFailure(@NonNull Exception e) {
        Log.e("saving","Saving failed: " + e.getMessage());
    }
});

Solution 2:

The reason was the firewall of our company. But I don't know why onDataChange callback function was called. I think onCancelled callback function should be called.

Anyway, I modified the firewall rule, and now it is working well.

Post a Comment for "Firebase Realtimedatabase Is Not Working Now?"