Timout/logout

Hello, I’m looking for a good practice to auto-logout my application.

This app works in disconnected mod. So I dont have any server or something to redirect the app.
Accounts are configured one time with the server, then it’s a local account (on the device only).

So I want to redirect to my first state (accountSelection) after 30min or something like that if the app running in background.
I don’t know how to do that, but it’s only local and offline application (with synchronisation)

I have found ng-idle but I have read that I need to put some code in all controllers, I would like to setup this configuration on .config or .run but not on .controller

So what I can do ?

thank you.