I want a timer code that can run in background and only stops when I want to. Basically, there are two buttons. Start timer and stop timer, and when I press the start button it starts the timer and it should automatically run in the background also, there is a TextView in the activity where I can view the timer counting down but it should not reset when I restart the application and must synchronize with the background service. And if possible, the app should notify me even when I am at my home screen when the timer finishes counting down.
Asked
Active
Viewed 682 times
0
-
1use AlarmManager and PendingIntent. – D.J Jan 16 '17 at 05:56
-
1have you tried countdown timer ? – Apoorv Mehrotra Jan 16 '17 at 06:17
1 Answers
0
Example of how to create a long running timer service that survives activity destruction by moving to the foreground, and back to the background when a new activity bind to it.

Sadiq Md Asif
- 882
- 6
- 18