Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

android - addOnCompleteListener not called offline with cloud firestore

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...