Code example for PowerManager.WakeLock

Methods: acquire

0
 
    public void acquireWakeLock() { 
        PowerManager manager = (PowerManager) mContext.getSystemService(
                Context.POWER_SERVICE);
        mWakeLock = manager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mTag);
        mWakeLock.acquire();
        Log.d(mTag, "Wake lock acquired");
    } 
 
    public void releaseWakeLock() { 
        if(mWakeLock != null && mWakeLock.isHeld()) {
            mWakeLock.release();
            Log.d(mTag, "Wake lock released");
        } 
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java