I have been writing an app using the new cloud firestore database. It works great except the fact that many things are not working smoothly when offline although the offline persistence is enabled.
For instance I do the following:
ref.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
//Do something
} else {
//Do another thing
}
}
});
However the onComplete
method is never called when offline. I want to close the activity and show some Snachbar once this happens. But as it never does, the activity remains open. I am using android studio emulator.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…