I'm making a APP
that keeps the smartphone screen always on , even when APP
is minimized.
I'm using a class with extends Service
to do this, in onCreate I put the code that keeps the screen always lit:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "watever");
wl.acquire();
Android Studio gives me an alert: FULL_WAKE_LOCK is deprecated , but I could not figure out how to do it in the current way.
This code is only working right up to KitKat . In Lollipop or later, it does not show any error, but does not work.
Example app that makes the screen stay lit even with the app closed: link