Android – event handler for closing / forcibly stopping applications

I am developing an ion application. I want to know if there are any event handlers for this situation when the application is stopped / closed in the following ways: 1) setting – > Application – > application name – > forced stop 2) sliding to close the application

I hope this is the case. But the best way I can find is to use $ionicplatform.registerbackbuttonaction to satisfy the exit of the app, excluding the above two scenarios

In addition, I'm not sure if this can also be done on the native platform. Please let me know

angular.module('app').run(function($ionicPlatform) {
    $ionicPlatform.onAppStopOrForceClose(function() {
        // Any function here
    });
});

resolvent:

ionic.Platform.exitApp(); // stops the app
window.close();

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

If you try to use IOS: you cannot exit the IOS application, apple does not allow the application to exit programmatically

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>