The new paging library can also work with Firebase?
Clash Royale CLAN TAG#URR8PPP
The new paging library can also work with Firebase?
The new paging library can also work with Firebase real-time database or Cloud Firestore? I know that it works asynchronously but is there any way it can work with a real-time database?
Thanks!
1 Answer
1
Regarding Firestore, you can use FirestorePagingAdapter
:
FirestorePagingAdapter
The FirestorePagingAdapter
binds a Query to a RecyclerView
by loading documents in pages. This results in a time and memory efficient binding.
FirestorePagingAdapter
RecyclerView
The FirestorePagingAdapter is built on top of the Android Paging Support Library.
FirestorePagingAdapter
@IoanaP. Peter is right, you can paginate using
FirestorePagingAdapter
and you're also right guessing that you'll lose the real-time feature. Please see Frank's answer from this post where he explains that FirestorePagingAdapter
is designed to get data, not to listen for realtime updates.– Alex Mamo
Aug 8 at 15:38
FirestorePagingAdapter
FirestorePagingAdapter
@IoanaP. If you want to use the real-time feature you should use FirestoreRecyclerAdapter, binds a Query to a RecyclerView and responds to all real-time events included items being added, removed, moved, or changed. Best used with small result sets since all results are loaded at once. If you have large result sets, you can load data in small chunks and for that I recommend you see my answer from this post.
– Alex Mamo
Aug 8 at 15:40
Thanks Peter, thanks Alex!
FirestoreRecyclerAdapter
is what I was looking for.– Ioana P.
Aug 8 at 15:49
FirestoreRecyclerAdapter
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thanks for your answer. If we are using
FirestorePagingAdapter
we lose the real-time feature, is it correct?– Ioana P.
Aug 8 at 13:45