I'm implementing the Content Provider API from Virgil Dobjanschi by making the requests from the Content Provider. I've looked here for instructions. In the presentation it says that you can send a flag (force download) through the URI and while showing the current data in the database, you also trigger a refresh request.
It all works good but if you implement LoaderCallbacks with CursorLoaders and send the CursorLoader with the force download flag, after data is updated in the database, the CursorLoader requeries with the same URI that has that flag (spanning new requests).
This results into infinite loops. I'm using and IntentService for the network requests. I'm storing a queue of requests that is sent to the Service, and removing it when the request, parsing and insertion in the db is finished. This is not enough. If a user changes orientation it triggers another request.
I user restartLoader() to which I send a bundle with a force download flag. If the user wants to refresh I do a restartLoader() with the new bundle and recreate the URI by adding a queryParameter.
Is there a best practice for this?