0

I have some questions regarding Jetpack Paging. First question, does the server needs to support the paging feature for frontend by creating an endpoint that keeps track of how many items that have already sent to the frontend? There are not much of tutorials out there and the existing tutorials are basically referencing the google codelab.

In the tutorials, I am seeing that they are sending query string "page" indicating the page number and "per_page" indicating the number of items per page. I assume that the server has an endpoint to consume these query strings.

Second question, in the tutorials Room DB is implemented along with the paging feature. Do I grab the data from the DB or can I just grab the data from the network call and send it to the UI? I am thinking that it will be slower if I store the data in the DB first and query the DB for the data. For this case, the DB will act as the data source with the device is offline.

calvert
  • 631
  • 10
  • 33

1 Answers1

0
  1. Yes, the API needs to support paging items that sent to app. The API will take the query params "page", "per_page" to return exact items on the current page with the limit of items.
  2. You can skip room db part if you only desire to display data, but if you want to change the item data it must be with database (for example if you want to delete an item on the view it needs to delete on the room db, you cannot modify the list on the pagingsource)
Thomc
  • 202
  • 1
  • 4
  • 10