I would like to capture an event when an application is opened.
Ex: The Waze app is open, from this moment I would like to capture an event and decide whether the application can continue its running or not.
Yes you can do in Ionic you can see .run function in ionic inside that you can write a function for the app what it should do when it is opened.
app.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
// write your function for capturing an event and make it use where ever you need.
});
})
.run will run automatically when an app is open and set everything you need for that app so try do you your stuff inside it so that will make you easy for you task