Is it possible to invoke a function after applications is re-opened (closed with home button, not closed as a process)?
Yes, you can do this using by injecting the $ionicPlatform service into either a run block (for the entire app) or into a single controller.
Here is an example of it in a run block:
.run(function($ionicPlatform) {
$ionicPlatform.on('resume', function(){
// Do sweet stuff!
});
}
And here it is in a controller:
.controller(function($ionicPlatform) {
$ionicPlatform.on('resume', function(){
// Do sweet stuff!
});
}
Note that this is really just a wrapper for Cordova's resume lifecycle event. You can see more information about the $ionicPlatform service and the 'on' method in the Ionic framework docs here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With