How to detect inactive users?

Hi all

I created some rather complex apps with ionic and I really do love it.
For one of those apps I got a feature request where the app should detect an idle/inactive user (e.g after 10min) and automatically log him out. What I would normally do now is just to create a listener inside the app section that listens for tap events and resets the timer every time the app registers a touch. While this seems like the simplest solution I wonder if there is a better solution. Any idea?