Detect user inactivity/idle (subclass UIApplication)

ios

#1

I need to detect user inactivity to perform an action like log out the user. However I can’t find out how to do this on iOS and Angular.

I tried a tap listener on my Page but that will not get triggered if there is a button in the way so I’d have to put a listener on everything ever that is tappable with that solution.

Instead I found UIApplication that has a sendEvents function that could be used but I can’t find how to subclass that class? I found how to use UIApplicationDelegate but it doesn’t let me intercept events.

How do I subclass UIApplication or solve this in another way?


#2

Here is how you can customize the application delegate, with Angular you will do it before application boostrap.

https://docs.nativescript.org/core-concepts/application-lifecycle#ios-uiapplicationdelegate


#3

Thanks, but as I said, I found how to use the UIApplicationDelegate already. The same link that you provided but it doesn’t let me intercept all touch events. Unless I missed something? I need to extend the UIApplication class.


#4

Can’t find a way to do this without adding code on every clickable thing in my whole app…

Found this answer for android. And some more supposedly useful links for iOS here and here. I need a solution for iOS and don’t know how to extend the UIApplication which seems like it’s possible but maybe you have to fiddle in the private api of Nativescript, not sure.


#5

followed the above mentioned steps but unable to track userinteractivity in ios…

If there is any progress or suggestion …please let me know