What is the best option to query a list if items, including the item name and id, using the InventoryContract?
Some merchants can have a very large catalog of categories and inventory items so performance may be an issue in those situations. What would give the best user experience on Clover hardware for merchants with large inventory catalogs? How does the Clover team do it for the Register App?
Using the InventoryContract.Category.contentUriWithAccount(cloverAccount) Uri we can get the categories which include a list of item id's belonging to each category.
Now to get the Items using the InventoryContract.Item.contentUriWithAccount(cloverAccount) Uri. I can see 3 ways to do this.
Do a single query and retrieve ALL the items and store them in memory. When a category is selected, filter that list to using the IDs from the category
Advantage: only a single query
Disadvantage: Storing a what can be a really large list of ALL the item ids and names in memory.
Disadvantage: Need to filter the long list.
When a category is selected, do a query to the items Uri passing in the item IDs as selection args.
Advantage: Storing less data in memory.
Disadvantage: The list of IDs belonging to a category may be large. Is there a limit to the number of selection args that can be passed into a content resolver query?
Disadvantage: Need to do a query for every category that is selected
Have the recycler view query the items Uri, or even use the InventoryConnector, for each item it is displaying on screen.
Advantage: Only using the memory for what the recycler view need to display on screen
Disadvantage: A query for every inventory item
Disadvantage: Complicates the view code