First time open (or re-open)

Hi you all,

Is there any way I can detect when the user opens or reopen the application? I have to be able to retrieve some data from the backend when the application is open.

I have an abstract view with a controller (ApplicationController) and the first view’s controller is DashboardController, so I tried using:

$rootScope.$on('$ionicView.enter', function (e, view) {
    // Retrieve data here

But when I navigate to any other view, the event gets fired of course, which tells me that no matter where I use this approach the result will be the same.

Is there any event that gets fired when the application is hidden or shown?

Thanks in advance!