javaandroidxposed-framework

Method to check if phone screen is on or not


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.


Solution

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

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