Showing an alert when user tries to exit app with back button


#1

Hi guys,

I’m trying to catch when the user uses the back button to exit the app on Android. I’d like to confirm the action with an alertCtrl.

How do you listen for back button exits and what needs to be called to exit the app?

I’ve tried this as a listener but it doesnt seem to fire.

this.platform.registerBackButtonAction(my_exit_handler)

was added to my platform.ready in app.component,ts


#2

I did the same for ionic 2. Let me know if you are still looking for it…


#3

We implemented a solution that worked well.

I wouldnt mind seeing how you did it just to get a different perspective.


#4

How do you solve? Can you share the code? Thx