2

I need to detect user's inactivity time in NativeScript app. I tried with few plugins (like ng-idle) but they are not compatible with NativeScript. I also tried to to emit application level event (in page router outlet) but it is not working either. Any help will be appreciated.

1 Answers1

2

In the mobile context, you would like to track the inactivity in the native mobile application lifecycle. For Android, you can extend the Application and implement some of the solutions shown here. Following this approach, you can do the same on iOS (overwrite the AppDelegate as shown here and implement some of the native solutions)

Nick Iliev
  • 9,610
  • 3
  • 35
  • 89
  • Ok. But onUserInteraction() method is not returning anything? @nick – Avijit Feb 15 '18 at 11:08
  • updated demo with `onUserInteraction` https://github.com/NickIliev/NS-Issues-2018/tree/master/NativeScript/issue_5423 – Nick Iliev Feb 16 '18 at 09:54
  • Thanks for the demo. It worked for me as well. I was trying to implement it for IOS as well. I created a delegate and it is working but somehow I am not getting a callback for **sendEvents**. Do you by any chance have a demo for ios as well? – Avijit Feb 16 '18 at 13:38
  • @NickIliev waiting for a answer if you have. Currently stuck here. – Avijit Feb 19 '18 at 08:58
  • @Avijit Can you provide a link to a demo project – Nick Iliev Feb 19 '18 at 12:03