Application exitEvent


#1

Hi All,
I want to trigger an event when application has been killled in native script.
I have added the following code .
application.on(application.exitEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an android activity class.
console.log("exit Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log("exit UIApplication: " + args.ios);
}
});

but the event was not triggering in app.js file all other events are triggering except this exit event like( suspend, launch, resume)


#2

Please be more detailed when you raise a issue.

  • Which platform you are testing (iOS / Android / both)
  • What framework you are using (Core / Angular / Vue)
  • What is the version of nativescript

#3

I had a quick test with playground, seems the exit events are working as expected in both platforms.


#4

I want kill event not exit event(exit event means back button).


#5

I suggest you be clear on your statement and what you exactly need first.

If you need back button event then use activityBackPressed, I’m not sure why you even have to create this post about exitEvent.