WakeLock

import android.os.PowerManager;
import android.os.StatFs;
import android.os.PowerManager.WakeLock;


        PowerManager pm  = (PowerManager) getSystemService(Context.POWER_SERVICE);
        WakeLock mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "SoundRecorder");


        if (state == Recorder.RECORDING_STATE || state == Recorder.PLAYING_STATE) {

            mWakeLock.acquire(); // we don't want to go to sleep while recording
        } else {
            if (mWakeLock.isHeld())
                mWakeLock.release();
        }


你可能感兴趣的:(WakeLock)