//AndroidManifest.xml uses-permission android:name="android.permission.WAKE_LOCK"
import android.os.PowerManager; //init PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Tag name"); //acquire mWakeLock.acquire(); //release if( mWakeLock.isHeld() ){ Log.d(TAG, "wake lock release"); mWakeLock.release(); }
wake lock 주체를 아래서 확인 가능
$cat /sys/power/wake_lock
'android' 카테고리의 다른 글
native service를 aidl로 binding (0) | 2020.07.17 |
---|---|
ForegroundService test (0) | 2020.07.08 |
Xlint error in Android studio (0) | 2020.04.24 |
Keystore file not set for signing config release 에러 발생 (0) | 2020.04.24 |
android apex에 관한 글 (0) | 2020.02.19 |