Firestorepagingadapter Not Receiving Realtime Updates

which is better using FirestorePagingAdapter or manually paginate

As Frank van Puffelen explained in this post:

The FirestorePagingAdapter in the FirebaseUI library is designed to get data, not to listen for realtime updates.

And Doug Stevenson in this post:

Unfortunately, you can't have both realtime updates and paging at the same time.

So if you want to FirestorePagingAdapter or the Paging Library, it means you'll loose the realtime feature.

So which one is better using FirestorePagingAdapter or paginate

If you need to implement paging for your items and have in the same time the realtime feature, then please see my answer from this post and instead of using a get() call, you need to use addSnapshotListener() as explained in the official documentation regarding listening to multiple documents in a collection.

FireStorePagingAdapter not receiving realtime updates

What you're seeing is the expected behavior.

The FirestorePagingAdapter in the FirebaseUI library is designed to get data, not to listen for realtime updates.

How to add 2 different queries inside an FirestoreRecyclerAdapter?

There is nothing built-in to combine two queries in a FirestoreRecyclerAdapter.

The best I can think of is creating a List/array of the combined results in your app code and then using an array adapter. It's not ideal, since you won't be using FirebaseUI.

Alternatively, have a look at FirebaseUIs FirestorePagingAdapter, which combines multiples pages of (non-realtime) DocumentSnapshots in a single recycler view.



Related Topics



Leave a reply



Submit