Reputation: 744
I try to get services into my weather application.
Let's assume that user has set up locations (cities list), and that he tap an Update button. In my case, this tap is caught by MainActivity
. After that, the application should read from sqlite user locations to update weather data, loop through this list of locations, for each of them send request to weather provider, parse json and put weather data into database. On success, the current view should be updated to show data that was just received. How should I separate all this logic between MainActivity
and services, and which type of services should I use? I think, it can be intent service to get the weather from provider and insert it into database, and bound service to update user layout (view).
Also, when we have a weather update schedule, should be created a service, that runs permanently in the background, and launches weather update process automatically. Which type of android service schould be used in this case?
Thank you.
Upvotes: 0
Views: 484
Reputation: 27211
There are several methods. Just some of them.
Application
class.Upvotes: 1