Hi and thanks for your help.
I have the following situation.
I have a Lock Screen Widget, when the user taps it the App Widget perform some tasks (updates itself).
The point is that: if the phone is in sleep mode and the user taps the App Widget, the App Widget would update itself, but the App Widget itself is not visible.
Therefore I need to wake up the device when the user taps the Lock Screen Widget - and after it can go to sleep again :-) -
Therefore I could use:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "bbbb");
wl.acquire();
In the AppWidgetProvider. The point is: how do I call "release()" so that the device can go back to sleep?
If I do:
PowerManager pm = (PowerManager) ctxt.getSystemService(Context.POWER_SERVICE);
WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "bbbb");
wl.acquire();
wl.release();
in the AppWidgetProvider simply the device never wakes up.
Any suggestion more than welcome!
Thanks!!