0

I have an android application that will dim the screen due to inactivity. This is typically after 15 seconds. Any touch brings the screen to full brightness.

When the screen dims I want to perform some actions on screen.

It seems there is no intent to capture screen dim.

My plan is to create a service that runs in the background. This service will find the dim due to inactivity timeout (15s) and start a runnable. Once the runnable executes it will perform my actions screen.

The service will also need to detect any touch from any screen to immediately go back.

Is there a simpler way to do this? Think of my screen action as turning on a screen saver. A screen saver that must be active only when the screen has dimmed due to inactivity.

It looks like I could have used the PowerManager in Android to check if the device is in idle mode. However my version of Android is so old this has not been implemented.

Michael
  • 399
  • 2
  • 17
  • Does this answer your question? [How to detect when the screen will turn off?](https://stackoverflow.com/questions/40285896/how-to-detect-when-the-screen-will-turn-off) – javdromero Jun 17 '21 at 16:15
  • Unfortunately no, the screen is not turning off, just dimming in brightness. I do not see an intent to capture that. – Michael Jun 17 '21 at 16:43
  • @Darkman could you elaborate? – Michael Jun 17 '21 at 17:25

0 Answers0