2

I wrote a little widget for Android devices.

The widget uses AlarmManager to set recurring updates. I'm using the RTC clock for the AlarmManager.

According to the documentation, if the device is sleeping, the RTC clock won't wake up the device and the next update will be when the device is woken.

I have a log file for the widget which shows when it was updated.

Even when I don't touch the device , I still see updates in the log file.

Why is that? shouldn't the device be sleeping and thus my widget shouldn't update?

I'm using System.currentTimeMillis() for the starting time so it should be correct for RTC clock.

x29a
  • 1,761
  • 1
  • 24
  • 43
Ran
  • 21
  • 2
  • 1
    Maybe some other application keeps the processor in running state with a lock. – Pentium10 Aug 25 '10 at 12:10
  • 2
    @Ran please check `/sys/power/wake_lock` via `adb shell` if it's empty or not – Andrey Ermakov Jun 25 '12 at 16:07
  • possible duplicate of [Allowing the phone to sleep while using RTC alarm on Android](http://stackoverflow.com/questions/6112327/allowing-the-phone-to-sleep-while-using-rtc-alarm-on-android) – Dan Hulme Jul 01 '13 at 10:13

1 Answers1

12

You need to disconnect device from your desktop. When device is charging it doesn't go to sleep mode even when screen is black.

inazaruk
  • 74,247
  • 24
  • 188
  • 156