I want to set the wakelock time to the "unlimited" time or at least set the time to xx minutes / hours. If I try these code :
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
wl.acquire();
It just give me 30 seconds for the wakelock. But if I change my code to wl.acquire(10*60*1000L /10 minutes/); as suggested from Android Studio, it didn't give any change to the wakelock time, any idea of it ?
Make sure you have the Manifest Permissions tag
make sure to call wakeLock.release() when leaving the activity
Wakelock doesn't exactly mean it will keep your screen on. if you want to keep the screen on :
then when you want to turn it off :