We are looking for a way to send a notification to the user's device when our app is closed rather than just paused.
On iOS, this occurs when you double click the home button and swipe up on the app, while on Android it happens when you press the Menu button and swipe the app to the right.
In Cordova, there are several events including:
- deviceready
- pause
- resume
- backbutton
- menubutton
- searchbutton
- startcallbutton
- endcallbutton
- volumedownbutton
- volumeupbutton
- activated
Unfortunately, none of these events will be triggered when the app is terminated. The closest event is pause
, but this is also fired when the app is sent to the background with no distinction between being terminated or just paused. Any necessary processes would only occur once the app is resumed later.
Our query is, how can our server reliably detect when the app has been terminated so that we can send a push notification accordingly?