Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.72 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Why no push notification or some notification for incoming messages in the screen when the phone is in locked state? on Galaxy note
  2. public abstract class WakeLocker {
  3.     private static PowerManager.WakeLock wakeLock;
  4.  
  5.     public static void acquire(Context ctx) {
  6.         if (wakeLock != null) wakeLock.release();
  7.  
  8.         PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
  9.         wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
  10.                 PowerManager.ACQUIRE_CAUSES_WAKEUP |
  11.                 PowerManager.ON_AFTER_RELEASE, MainActivity.APP_TAG);
  12.         wakeLock.acquire();
  13.     }
  14.  
  15.     public static void release() {
  16.         if (wakeLock != null) wakeLock.release(); wakeLock = null;
  17.     }
  18. }