Suspend/Resume event of app


#1

Hello, Can some one explain how to handle suspend/Resume events using PhoneGap/ionic?


#2

Any input on this please?


#3

Have a look at this post:

You need to setup Cordova’s ‘resume’ and ‘pause’ event handlers.
http://cordova.apache.org/docs/en/3.5.0/cordova_events_events.md.html


#4

I do this in my app.js module .run function:

$document.on("resume", function( event ) {
    // do stuff with your $rootScope such as this:
    $rootScope.$broadcast('myCordovaResumeEvent');
});

Then listen to your “myCordovaResumeEvent” in your controllers. I am using $document, Angular’s abstraction of document. I am assuming it plugs into Angular digest cycles some how.