在 NativeScript 中检测应用程序不活动/空闲超时 [英] Detect App inactivity/idle timeout in NativeScript

查看:47
本文介绍了在 NativeScript 中检测应用程序不活动/空闲超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检测用户在 NativeScript 应用中的不活动时间.我尝试了几个插件(如 ng-idle),但它们与 NativeScript 不兼容.我还尝试发出应用程序级事件(在页面路由器出口中),但它也不起作用.任何帮助将不胜感激.

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.

推荐答案

在移动上下文中,您希望跟踪本机移动应用程序生命周期中的不活动.对于 Android,您可以扩展应用程序并实现此处显示了一些解决方案.按照这种方法,您可以在 iOS 上执行相同操作(覆盖 AppDelegate,如下所示 here 并实施一些本机解决方案)

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)

这篇关于在 NativeScript 中检测应用程序不活动/空闲超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆