Event when app is closed (not sent to background)


#1

Hi !

I would like know if it exists an event raised when app is closed (and not sent to background).

Thanks for your help :smile:


#2

There’s no such event. Such functionality is prohibited on OS level.


#3

Hi.

Thanks for your answer. So, how can I execute a fonction only when app is launched and not when it’s resumed ?

If I call my method in run method of my app.js, does it work ?


#4

I think run should do it, though you will need to test it.

On the other hand, there’s one other solution.

  • Create a dummy view and make it default initial page.

  • Add view entry event to this dummy view controller

  • When view entry event triggers do your thing

  • Programmatically change page like this:

    $state.go(‘home’, {}, {location: ‘replace’});

  • it will remove dummy page from history and you will not be able to move back to it