How to prevent back navigation even with the hardware button?


#1

I want to show a page/popup and prevent the user from closing it or navigating elsewhere even with the hardware back button. Think of it like a T&C form which they must accept before proceeding or moving anywhere else, but presently, if they hit the hardware back button, they can navigate to the previous page, and if I set it as the root page, then the app will close.


#2

Take a look on this tutorials it may be helpful :blush:
http://www.codingandclimbing.co.uk/blog/ionic-2-android-back-button-13


#3

I want to note, that the API for this isn’t fully public, and is going to change as time goes on. Best right now is to not try to force it and possibly break your app.


#4

There’s got to be a way to do this.

I’m trying to put facebook authentication on my app. It’s not the root page, but could be I guess. Still, if I don’t want it to be a root page, there’s got to be a functional way to prevent users from leaving the login page with the hardware-back-button.


#5

If I was a user I would absolutely hate an app that did this.


#6

if you are on the login page or redirect to the login page --> set it as root page and you have no problem with history go back :wink: