Yes, the system kills the app at any time. But i have this condition being 
handled by rescheduling the timer after being restarted. The app was killed 
after 8 hours and then restarted. A timer was scheduled for the remaining 
16 hours which didn't go off. The process id was the same.


On Sunday, March 18, 2012 8:10:31 PM UTC-7, Zsolt Vasvari wrote:
>
> You might want to read up on the lifecycle of an Android app and how the 
> system can kill it any time for any reason.
>
> On Monday, March 19, 2012 10:58:16 AM UTC+8, Tarak wrote:
>>
>> Thanks Mark. Why can't timers or handlers be used ?. There is nothing in 
>> the documentation  of why  timers or handlers cant be used to run tasks 
>> after 24 hours.
>> AlarmManager  is more heavy weight on the OS. The documentation says 
>> that you must acquire a WAKE lock when processing the alarm, since the 
>> device can go to sleep as soon as the Intent is processed.  This behavior 
>> is also not what we really want for the application. The application has a 
>> simple requirement to run a task every 24 hours. 
>>
>> - Tarak
>>
>> On Sunday, March 18, 2012 3:27:16 PM UTC-7, Mark Murphy (a Commons Guy) 
>> wrote:
>>>
>>> On Sun, Mar 18, 2012 at 3:07 PM, Tarak <tsri...@ipass.com> wrote:
>>> > I have a requirement to run a task periodically after 24 hours and 
>>> made use
>>> > of postDelayed (Runnable r, long delayMillis) .
>>>
>>> Do not do that. Use AlarmManager for periodic tasks like this.
>>>
>>> -- 
>>> Mark Murphy (a Commons Guy)
>>> http://commonsware.com | http://github.com/commonsguy
>>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>>
>>> _Android Programming Tutorials_ Version 4.1 Available!
>>>
>>>
>> On Sunday, March 18, 2012 3:27:16 PM UTC-7, Mark Murphy (a Commons Guy) 
>> wrote:
>>>
>>> On Sun, Mar 18, 2012 at 3:07 PM, Tarak <tsri...@ipass.com> wrote:
>>> > I have a requirement to run a task periodically after 24 hours and 
>>> made use
>>> > of postDelayed (Runnable r, long delayMillis) .
>>>
>>> Do not do that. Use AlarmManager for periodic tasks like this.
>>>
>>> -- 
>>> Mark Murphy (a Commons Guy)
>>> http://commonsware.com | http://github.com/commonsguy
>>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>>
>>> _Android Programming Tutorials_ Version 4.1 Available!
>>>
>>>
>> On Sunday, March 18, 2012 3:27:16 PM UTC-7, Mark Murphy (a Commons Guy) 
>> wrote:
>>>
>>> On Sun, Mar 18, 2012 at 3:07 PM, Tarak <tsri...@ipass.com> wrote:
>>> > I have a requirement to run a task periodically after 24 hours and 
>>> made use
>>> > of postDelayed (Runnable r, long delayMillis) .
>>>
>>> Do not do that. Use AlarmManager for periodic tasks like this.
>>>
>>> -- 
>>> Mark Murphy (a Commons Guy)
>>> http://commonsware.com | http://github.com/commonsguy
>>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>>
>>> _Android Programming Tutorials_ Version 4.1 Available!
>>>
>>>
>> On Sunday, March 18, 2012 3:27:16 PM UTC-7, Mark Murphy (a Commons Guy) 
>> wrote:
>>>
>>> On Sun, Mar 18, 2012 at 3:07 PM, Tarak <tsri...@ipass.com> wrote:
>>> > I have a requirement to run a task periodically after 24 hours and 
>>> made use
>>> > of postDelayed (Runnable r, long delayMillis) .
>>>
>>> Do not do that. Use AlarmManager for periodic tasks like this.
>>>
>>> -- 
>>> Mark Murphy (a Commons Guy)
>>> http://commonsware.com | http://github.com/commonsguy
>>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>>
>>> _Android Programming Tutorials_ Version 4.1 Available!
>>>
>>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to