I am implementing simple timer and I require it to perfectly measure time.
Problem is that even using foreground, START_STICKY and wake lock when timer is started somehow time measuring is killed after some time when phone is not used. I assume it is going in deep sleep mode and then somehow my partial wakelock (only cpu required) is ignored.
Is there some way to prevent that? Just for the record, I am going with that solution as I think that simple time counting is not a big deal for cpu and it won't drain battery as hell.
One more thing, when testing on API 19 it seems not likely to be killed. On API 25, device with 'cleaner' Android it is usually killed after 30min to 2h after running. Kill is in my opinion not related to too high memory usage as my app is the only one running in background ( user started).
Thanks in advance for any ideas.