I am using a timer in my application for repeated task. By default, the timer
should repeat the task with a delay of one second. I am starting the timer when the application Starts. All this is works perfectly. Also,When I came out of my application and open some other application, the timer keeps running.
When I open Google Maps application, my timer stops running. I don't know why this is happening. I googled and found from the activity life cycle that, if other applications needs memory, all processes will be killed. This is what happening in my case, I guess.
I do not want my timer to stop. It must run always till the user uninstall my application.
- Why the above problem occurs?
- How to achieve my requirement?
- Does Using
services
will solve the problem? If so, Is there any way to keeptimer
always ON without usingservices
? - Does Alarm Manager be helpful? Even if the user restarts the phone, the timer should work properly.