dwalkes / WakeMeSki

An application for the Android OS which turns your phone into a ski or snowboard alarm clock with ski resort monitoring features. This project is based on android-ski-report found at http://code.google.com/p/android-ski-report/
www.wakemeski.com
7 stars 0 forks source link

Alarm does not fire on 2.2 in low memory conditions #20

Closed dwalkes closed 13 years ago

dwalkes commented 13 years ago

Noticed this after upgrading to 2.2 on my G1 with Cyanogen 6. The alarm would fire anytime I scheduled for a time shortly after launching the UI but would not fire after an overnight check. After looking at logs I determined the process was being killed before the resort check was complete.

I added setForeground() and implemented onStartCommand() in the service in an attempt to resolve, but the issue was not resolved until I removed the call to set THREAD_PRIORITY_BACKGROUND in ReportController. It appears when THREAD_PRIORITY_BACKGROUND is set as the priority on the only thread running in a process started as a background service and the system has memory pressure the process is killed, at least with 2.2.

dwalkes commented 13 years ago

Closed with 66fb67e71446e51edee1

Tested on my 2.2 device and 1.5 device running in emulator.