How I Can Change My Asynctask Into Service?
How is it possible to change my asyncTask into service because everytime i close the app or the restart the device my aysncTask not working . I have aysnc that sends Post request
Solution 1:
For time intervals larger than 30 secs you should use AlarmManager instead of Handler's .postDelayed method. See these tutorials: https://developer.android.com/training/scheduling/alarms.html, http://code4reference.com/2012/07/tutorial-on-android-alarmmanager/ . There is a JonScheduler for scheduling repeating tasks, Vogella has tutorial on it: http://www.vogella.com/tutorials/AndroidTaskScheduling/article.html . In a few words: you create Service (InteneService), create PendingIntent, pointing to that service and schedule AlarmManager, which will be sending that intent, which, in turn, sill be launcing your IntentService.
Post a Comment for "How I Can Change My Asynctask Into Service?"