阻止 Ionic 应用程序退出(PhoneGap / Cordova)

Block exit on Ionic application ( PhoneGap / Cordova )

我有一个应用程序,我想阻止不知道该应用程序的人退出它, 我该怎么做? 我只找到了一个阻止后退按钮的功能...

非常感谢...

我能找到的最接近的东西叫做 任务锁定 或 Android 上的 屏幕固定 。它仅在 Android Lollipop (5.0) 或更高版本上受支持。 documentation 对此功能有以下说法:

Android 5.0 introduces a new screen pinning API that lets you temporarily restrict users from leaving your task or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android, or a single-purpose or kiosk application. Once your app activates screen pinning, users cannot see notifications, access other apps, or return to the home screen, until your app exits the mode.

还有一些关于任务锁定的其他问题,您可以找到here and here

我已经找到了这个 here 的 Cordova 插件,但是目前它似乎不是很活跃。

遗憾的是,我认为这不会真正解决您的问题。从我能够(或无法)找到的内容来看,这似乎是不可能的。我认为这类似于用代码关闭iOS上的应用程序,操作系统开发人员根本不允许这样做。