I'd like to create an application to count how long user start the count timer. I created a sample. - My application has a button, when user clicks it, a Service is start - When Service start, it will set a variable noOfSeconds=0 to SharePreference and it start a timer to increase variable noOfSeconds for every seconds.
When my app is suspended (user go to other app or home screen), it works well. However, when it is suspended long time (over 2 hours), the noOfSeconds is wrong.
I guest that Android OS kill my suspended activity and background service when they are inactive long time.
Do you have any sample code to make a timer tick run in very long time?