1

I used this tutorial http://forum.xda-developers.com/showthread.php?t=1732939 to create a simple clock widget.

Sadly it's not running very well. When the screen is turned off, the widget won't update anymore so it won't show the corret time.

So, how can I update the widget even if the screen if turned off?

1 Answer 1

1

Take a look at Repeating Alarms:

They operate outside of your application, so you can use them to trigger events or actions even when your app is not running, and even if the device itself is asleep.

https://developer.android.com/training/scheduling/alarms.html

Or at "WakeLock":

One legitimate case for using a wake lock might be a background service that needs to grab a wake lock to keep the CPU running to do work while the screen is off. Again, though, this practice should be minimized because of its impact on battery life.

https://developer.android.com/training/scheduling/wakelock.html#cpu

Using the first approach can help you to get your point.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.