title: Android Lock Screen App Widget: how to wake up the device (and send it back to sleep again after)
body: <p>Hi and thanks for your help.</p>
  
  <p>I have the following situation.</p>
  
  <p>I have a Lock Screen Widget, when the user taps it the App Widget perform some tasks (updates itself).</p>
  
  <p>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.</p>
  
  <p>Therefore I need to wake up the device when the user taps the Lock Screen Widget - and after it can go to sleep again :-) -</p>
  
  <p>Therefore I could use:</p>
  
  <pre><code>PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
  WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "bbbb");
  wl.acquire();
  </code></pre>
  
  <p>In the AppWidgetProvider.
  The point is: how do I call "release()" so that the device can go back to sleep?</p>
  
  <p>If I do:</p>
  
  <pre><code>    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();
  </code></pre>
  
  <p>in the AppWidgetProvider simply the device never wakes up.</p>
  
  <p>Any suggestion more than welcome!</p>
  
  <p>Thanks!!</p>