Reputation: 2832
I am creating a app that would fetch data from a website every 2 minutes ..
I need to know whether I can go for a service ?
I tried using handlers and threads but it stops after 3 or 4 hrs I already tried using Async task but it's not working out..
Upvotes: 0
Views: 79
Reputation: 56925
You have to use service because its always runs in background . Thread and AsyncTask and any other handlers not give guarantees to runs in background life time of applicatin.
Here you can find good tutorial for service.
http://marakana.com/forums/android/examples/60.html
http://saigeethamn.blogspot.com/2009/09/android-developer-tutorial-for_04.html
http://mylifewithandroid.blogspot.com/2008/02/double-life-of-service.html
Upvotes: 1
Reputation: 583
Best to use a service, actually the best option there is to it. Always consider the users of your application as they do not want to see all that incoming and outgoing flow of data.
Upvotes: 0
Reputation: 2250
u use the service good option.because service is always running background process
if want know about the service
http://developer.android.com/reference/android/app/Service.html
Upvotes: 0