When the application turns off or turns off the screen, time stops. Why? Tried three options.
Activity
creates ahandler
and sends it to the service. The service launchesTimer
.Timer
once a second sends its state through thehandler
(updatesTextView
in the originalActivity
). Those. just "ticking" time in the corner of the screen.Everything is the same, just not using the
Timer
class, but just creating aThread
. And theService
starts it. ThisThread
through thehandler
updates theActivity
element.I do not create any threads, all the logic in the main thread
Service
-UI
hangs.
Why and how to make it work?