Is there a way to detect if the user is currently present without listening for the ACTION_USER_PRESENT-event and its counterpart ACTION_SCREEN_OFF?
I don't like to cache the last event in SharedPrefs, because I can't listen for ACTION_SCREEN_OFF using a receiver registered in the manifest. I want to avoid to implement a service that runs all the time just to get the ACTION_SCREEN_OFF-event. Because that service doesn't run anymore if my app crashes.
PowerManager#isScreenOn() or PowerManager#isInteractive() aren't an option since they return true if the user interacts with the lock screen.
Must support API level >=17.