//保持不休眠 private void acquireWakeLock() { if(mWakeLock == null) { PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, this.getClass().getCanonicalName()); mWakeLock.acquire(); } } //休眠 private void releaseWakeLock() { if(mWakeLock != null) { mWakeLock.release(); mWakeLock = null; } }
android 休眠
最新推荐文章于 2022-07-29 20:17:53 发布