Вопрос

the last couple of days i was busy getting a service up and running for an phone gap application (using the eclipse ide with the device (motorola defy android 2.3.) connected to my computer)/ the service runs in the background when the application is off and has a timer scheduled that passes an intent to launch my application at irregular times/ everything is working as intended/ when the application is off and the device sleeps (screen is black) the timer is still running and at the scheduled time the device gets woken up, the lock removed and the app starts/ however, the bummer came when i unplugged my device from my computer/ the timer seems to work only reliable in sleepmode when the device is connected to my computer/ when its not connected to my computer the timer only fires correctly when the screen is on/ when it is not on it fires unpredictable at will and more often not at all/ i switched off the option that the device should not go in deep sleep when charging/ but it still works when the device is either connected to a power outlet or computer

can anyone try to explain what the reason might be?

is there anything i can do to make sure the timer is running as is should unplugged while the device is sleeping

Это было полезно?

Решение

Sorry my bad, it doesn't FULLY answer your question

One way is to register for ACTION_SCREEN_OFF and ACTION_SCREEN_ON event at the native level and propagate that event to phonegap layer (@ html/js level).

More details on handling Screen Off and On intent click here.

More on how to Notify UI layer click here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top