In my app, I am using Firebase for database. Now when I am listening for any change in child nodes of a particular location, and if there is no internet connection, no callback gets fired. The firebase call just gets stuck.
I am using this,
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
firebaseDatabase.setPersistenceEnabled(true);
So, persistence is enabled. The problem occurs only one one scenario. When there is no data on the local persistence of Firebase and the internet connection is also not available.
I am using this,
addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
Timber.d("Cancelled");
}
});
I am not getting any of the two callbacks for that particular scenario.
What should I do to tackle this kind of scenario?