2

I'm trying to have an Xposed module check (on hardware button press) whether the phone screen is on or not. How would I do this, is there any method to check this? Thanks. EDIT: This needs to work on API 17 or more.

Grymfogel1
  • 127
  • 2
  • 14
  • 1
    possible duplicate of [How can I tell if the screen is on in android?](http://stackoverflow.com/questions/2474367/how-can-i-tell-if-the-screen-is-on-in-android) – Adam Aug 03 '15 at 20:59
  • No sorry, forgot to add, I need this to work on API 17+, and IsScreenOn() doesn't apply for at least API 17. – Grymfogel1 Aug 03 '15 at 21:01
  • `IsScreenOn()` Will definitely work on API 17 – Adam Aug 03 '15 at 21:03

1 Answers1

2

For any API under 20, you can use IsScreenOn().

For API 20+, you can use IsInteractive() as IsScreenOn was deprecated in API 20.

Adam
  • 2,422
  • 18
  • 29