title: Using a wakelock in a service Android 1.5
body: <p>Hello I am trying to use a service to control a wakelock so I can permanently leave the screen on when my application is running. I create the wakelock and activate it in onCreate() and release it in onDestroy() however I get the error "wl cannot be resolved". Can someone explain how I can get over this? Code below:</p>
  
  <pre><code>public class WakeLockService extends Service {
  
      @Override
      public IBinder onBind(Intent arg0) {
          // TODO Auto-generated method stub
          return null;
      }  
      @Override
      public void onCreate() {
          PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
          PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Tag");
          wl.acquire();
      }
      @Override
      public void onDestroy() {
          wl.release();
      }
  }
  </code></pre>