Event handler to close / force stop an ionic application

I am developing an ionic application. I am wondering if there is any event handler for this condition when the application stops / closes in the following ways:
1) Settings → Application → Application name → Force stop
2) Swipe to close the application.

I would expect something like that. But the best I could find was to satisfy the application coming out through $ionicPlatform.registerBackButtonActionwhich does not include the above scenario.

In addition, I'm not sure that this can be done on the native platform. Please report this.

angular.module('app').run(function($ionicPlatform) {
    $ionicPlatform.onAppStopOrForceClose(function() {
        // Any function here
    });
});
+4
source share
1 answer
ionic.Platform.exitApp(); // stops the app
window.close();

see http://ionicframework.com/docs/api/utility/ionic.Platform/

if you try on ios: you cannot exit the iOS application, Apple does not allow applications to exit programmatically

0
source

All Articles