My app will be running in the background and will alert the user if he isn't active on the device after 10 seconds. I cannot use the following method since the screen is supposed to be kept on all the time.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
boolean isScreenOn = pm.isScreenOn();
Another method I found is overriding OnUserInteraction()
on activity.
But it seem to only work on our app's activity. What I want is to know if the user is interacting even if the app is not in foreground ie, there's no user interface.
Is there any specific method to do this without using the screen timeout?
Is it possible to know if my device is inactive using a service?