I read a lot about network operations with Android and how to do it correctly. The documentation suggests using Volley, and it abstracts the process making the network request:
http://developer.android.com/training/volley/simple.html
As I use Retrofit in my application, I thought that the best practice was to use Loaders, as they behave well when changing orientation, but I found this:
http://www.androiddesignpatterns.com/2012/08/implementing-loaders.html
"Using Loader to perform network requests is not a big practice, because (1) this means that your application will work hard with the battery (when you re-poll new data from the network every time you start Activity, (2) there is no way to observe "behind the network, content changes without re-polling, and (3) your application will not work offline."
(1) is not particularly true because you can simply resume the bootloader when creating activity. I do not think that I fully understand that point (2) and point (3) do not care about me, since I do not have the ability to work offline normally.
However, this again caught my attention, at the same link.
"So my answer is to completely forget about using the Loader / AsyncTask combination and stick to the Service. The service can test the network for data every time and insert new data into the ContentProvider. Then you can use CursorLoader to load data from the ContentProvider without having to know what- or where the data comes from.
Has anyone used this approach to use the Service to poll the network and populate the ContentProvider? I do not think that it will work correctly with my application, as it uses a RESTful API, which is constantly being requested. I donβt think it would be particularly effective, but I could have missed something here.
Sorry for the long question. This is not a question for sure, but I want to create a discussion on the topic.