-1

I am asking about which is better using FirestorePagingAdapter or paginate it manually. By every swipe to refresh get a request with adding a new 20 items

The point is that:

I have an app have 10k users and I have a forum. This forum have 1000 posts and I want to reduce its costing because in one getting its get the 1000 post. S which one is better using FirestorePagingAdapter or paginate it that every swipe its adding 20 posts

Thank u

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Muhammad
  • 601
  • 2
  • 9
  • 18

1 Answers1

1

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.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
  • thank u for your answer .. iam sorry i couldnt open yesterday .. your answer really helped me but .. i was hope to know .. is FirestorePagingAdapter gonna reduce the cost of my firestore database by reducing requests as i explained in my question – Muhammad Feb 21 '19 at 11:55
  • Good to hear that it helped. It will, since `FirestorePagingAdapter` does not listen for realtime updates. So when you get the data, you won't have any additional reads when the data is changed. – Alex Mamo Feb 21 '19 at 11:58