Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Inactivity/Activity regardless of top app
    text
    copied!<p>I need to find out when the last user interaction was, regardless of which application is on top. I don't care about where or what the event was I just need to know when it was. Or alternatively, as it happens, I receive an event.</p> <p>I've tried multiple things:</p> <ol> <li>Create service with a window and added a touch listener. This ate the touch event and didn't pass it down</li> <li>Looked for a shell command. <code>getevent</code> works (new line comes in every time a touch is received) however you need root and so it is not an appropriate solution for me.</li> <li>Looked for "time until lock" but came up with nothing.</li> </ol> <p>Also note: There is no security concern with this as I don't need any identifying information such as touch location. Just a type stamp (or live event).</p> <p>I'm open to using reflection to figure it out as well.</p> <hr> <p>@user2558882 has a very good solution. As of now, that's the best approach I've come across.</p> <p>While that's great, it still requires the user to manually enable our application in the accessibility controls. We have customers with thousands of devices and we have a way to automatically update and change settings. We try and keep manual configuration to a minimum, but some things still require user input such as enabling Device Admin mode. So this solution is acceptable however I'm still open to a way that doesn't require any user input to enable.</p> <hr> <p>I ended up implementing @user2558882's idea to use an accessibility service. Though other ideas are welcome.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload