title: Achieve Partial wakelock inside asyncTask Class
body: <p>I have an application that runs a long process. I am using AsyncTask class to achieve it. But when the phone sleeps the async task automatically stops. 
  To stop this behaviour I want to achieve a partial wakelock when the doInBackgound starts and release it when it ends.</p>
  
  <p>But when I paste the following code in doInBackground method, the getSystemService gives the error that it is undefined for the type myclass.</p>
  
  <pre><code>        PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
  </code></pre>
  
  <p>Can you gimme a workaround for this..</p>
  
  <p>What I want to do is..</p>
  
  <pre><code>class doit extends AsyncTask&lt;String, String , Void&gt;
  {
  @Override
  protected Void doInBackground(String... params) 
  {
  //Achieve Partial Wakelock
  //Do long Work
  //Release Lock
  }
  }
  </code></pre>