How to do some action before exiting app ionic2

How to do some action before exiting app in ionic2…

please help me out for this action

Put this lines in the page(s) you want to control for exit:

import { Platform } from 'ionic-angular';

and in its/their costructor:

  this.platform.registerBackButtonAction(() => {
    this.exit(this.platform)
  });

the function exit will do something before exit:

exit(piattaforma) {
     blah bla blah
     piattaforma.exitApp();  
}

Have a good job!

P.

Thank you… Its working fine…