In the process of developing a Cordova application through Visual Studio, I have encountered an issue on Android. Specifically, I am trying to implement a detection mechanism for when the user closes the app by performing a long press on the device's menu button followed by a swipe gesture. Unfortunately, the standard events provided by Cordova (onPause/onResume) do not seem to work for this purpose.
Although the onPause event triggers when I tap the device's home button, I have attempted utilizing both document.body.unload and window.unload events without success on Android. Surprisingly, these events function properly on Windows Phone but fail to work on Android.
I also explored using a Cordova plugin from https://github.com/agamemnus/cordova-plugin-ondestroy to capture the desired event, but it appears that the plugin is outdated as indicated by the "class not found" error in the JavaScript console.
If anyone can provide assistance or guidance on how to achieve the intended functionality, it would be greatly appreciated. Thank you.