Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect when the screen is on?

Tags:

android

As mentioned in a previous question, I am having difficulty intercepting all android.intent.action.SCREEN_ON events without a long-lived Service (discouraged).

I may be able to work around the need if I can simply work out when the screen is on at any given time, in the Service.

Can anyone suggesting a method call that would return this information? 1.5 upwards.

like image 558
Jim Blackler Avatar asked Apr 04 '10 19:04

Jim Blackler


People also ask

How do you detect displays?

Select Start , then open Settings . Under System , select Display . Your PC should automatically detect your monitors and show your desktop. If you don't see the monitors, select Multiple displays , then Detect.

Why is monitor not detected?

A buggy, outdated, or corrupted graphics driver may be one of the main reasons why Windows 10 won't detect your second PC monitor. To resolve this issue, you can update, reinstall, or roll back the driver to a previous version to fix and restore the connection between your computer and the second monitor.


1 Answers

PowerManager.isScreenOn() Since: API Level 7

like image 98
luser845 Avatar answered Sep 18 '22 04:09

luser845