title: How to use the PowerManager and PARTIAL_WAKE_LOCK
body: <p>I develop a small app, this one have to run always over all when the device is sleep or deep sleep (press right button to turn off the screen) I read many posts about it, and all tell me that the way is use PowerManager, and my question is if I use fine this command, my structure is> myActivity.class, ReceiverBoot.class and ServiceBoot.class, I use the POwerManager class on myActivity.class like this:</p>
  
  <pre><code>PowerManager mgr = (PowerManager)this.getSystemService(Context.POWER_SERVICE);
  PowerManager wakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP , "MyWakeLock");
  </code></pre>
  
  <p>on onCreateMethod after of this one put </p>
  
  <pre><code>wakeLock.acquire();
  </code></pre>
  
  <p>and after of this one I have a </p>
  
  <pre><code>super.onCreate(savedInstanceState);
  this.mTimer.scheduleAtFixedRate(
                  new TimerTask(){
                      @Override
                      public void run(){doTask();}
                  } , 0, 1000);
  
  wakeLock.release();
  </code></pre>
  
  <p>on Manifest XML code I have</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  </code></pre>
  
  <p>and on layout XML code have</p>
  
  <pre><code>android:keepScreenOn="true"
  </code></pre>
  
  <p>but after to 10seg the creen es OFF always but the app is running, jut with wifi.</p>
  
  <p>the app work very fine with wifi conn, but when change to 3G conn, the app is gone, I use fine this command?? the problem is the kind of conn to Internet??? thanks a lot!</p>