title: How to get an Android WakeLock to work?
body: <p>My WakeLock isn't keeping my device awake.</p>
  
  <p>In <code>OnCreate()</code> I've got:</p>
  
  <pre><code>PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
  mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "My Tag");
  mWakeLock.acquire();
  </code></pre>
  
  <p>then:</p>
  
  <pre><code>new CountDownTimer(1320000, 200) {
  
      public void onTick(long millisUntilFinished) {
          // I update a progress bar here.                                         
      }
  
      public void onFinish() {
          // I finish updating the progress bar.
          mWakeLock.release();
      }
  }.start();
  </code></pre>
  
  <p>The screen turns off before the timer finishes, how can I make the screen stay visible?</p>
  
  <p><code>mWakeLock</code> is a field previously declared like so:</p>
  
  <pre><code>private PowerManager.WakeLock mWakeLock;
  </code></pre>
  
  <p>My device uses Android 1.6.  I would really appreciate any help to resolve this.</p>