@herdwatch/cordova-plugin-app-lifecycle
v1.0.3
Published
App lifecycle actions not covered by Cordova core. Currently: cleanly terminating the app process on iOS and Android, replacing the firebaseX.sendCrash() workaround previously used to force-close the app.
Readme
cordova-plugin-app-lifecycle
App lifecycle actions not covered by Cordova core. Currently: cleanly terminates the app process on iOS and Android.
Why
navigator.app.exitApp() (Cordova core) has no iOS implementation — Apple's guidelines discourage
apps from quitting themselves, so cordova-plugin-whitelist/core never added it there. As a workaround,
Herdwatch was calling firebaseX.sendCrash() to force the app to close after an IndexedDB corruption
error (see FARM-9765). That deliberately triggers a real native crash purely to end the process, which
pollutes Crashlytics crash-free-user metrics and can trigger false on-call alerts.
This plugin exposes a real forceClose() action instead:
- iOS: calls
exit(0)after a short delay (letting the JS success callback round-trip first). This is a clean process exit, not a crash — Crashlytics does not report it as one. - Android: calls
Activity.finishAffinity()followed byProcess.killProcess(Process.myPid())so the whole task is torn down, not just backgrounded.
Installation
npm install @herdwatch/cordova-plugin-app-lifecycleUsage
cordova.plugins.appLifecycle.forceClose();The call does not resolve on success — the process exits before any callback can fire. It only rejects if the native side reports an error before exiting.
