public void acquireWakeLock ( ) { if ( mWakeLock == null ) { PowerManager manager = ( PowerManager ) mContext . getSystemService ( Context . POWER_SERVICE ) ; mWakeLock = manager . newWakeLock ( PowerManager . PARTIAL_WAKE_LOCK , mTag ) ; mWakeLock . acquire ( ) ; Log . d ( mTag , "Wake lock acquired" ) ; } else { Log . d ( mTag , "Already have a wake lock -- keeping it" ) ; } }
Acquire a wake lock if we don t already have one .