2
I’m making a APP
that keeps the smartphone screen always on, even when the 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 couldn’t figure out how to do it in the current form.
This code is only working until the Kitkat.
In the Lollipop or later, it does not present any error, however it does not work.
Example of app that makes screen stay lit even with the app closed: https://play.google.com/store/apps/details?id=com.brilliant.apps.screenon
I was curious because I need to keep the screen on from inside a
Service
, would you really need to? Just keep the CPU active using aPARTIAL_WAKE_LOCK
would not solve?– Wakim
The goal is to make the user leave the smartphone screen always on, using this feature with the app minimized or closed. If you know a form without using the Service it can also be. But it has to be able to use this feature with the APP minimized or closed.
– CristianCotrena
With the Service, the user can use the screen on feature even when closing the APP, the apps that exist today in Google Play do like this for example: https://play.google.com/store/apps/details?id=com.brilliant.apps.screenon
– CristianCotrena