Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 by Process.killProcess(Process.myPid()) so the whole task is torn down, not just backgrounded.

Installation

npm install @herdwatch/cordova-plugin-app-lifecycle

Usage

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.

About

Cordova plugin for app lifecycle actions not covered by Cordova core. Provides forceClose() — a clean process exit on iOS and Android, without faking a crash.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages