whether I should go for a service or handlers? in android
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 worki开发者_如何学运维ng out..
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
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
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.
精彩评论