In my application, under certain activity must keep the screen always active (classic keepScreenOn).
In order to reduce a little battery consumption, I would like to implement an energy saving system (similar to the default) type:
After 10 seconds of inactivity, the brightness goes to a minimum (without ever sending the activity paused or similar) to tap the brightness returns to normal and so on ...
is possible to implement such a system? there is an automatic way to calculate the idle time? (because otherwise I would create a cooldwon from 10 to 0, to be carried forward to 10 to each user's tap ...)
Thank you very much
at first write the following permission in your manifest.xml file
then, when the 10 seconds pass, run the following code to reduce the Brightness of the device to it's lower level:
and in case you need know how to make sure that it waited for 10 seconds without any user activity, implement the above code the following way: