Disable hardware back button after setRoot to next page

I have a problem on my ionic 2 project, i have a sequence of pages like this:

Splash screen> Welcome Page> (setRoot) Home Page

as we know the page that ‘setRoot’ does not have a back button on the UI, but why when I press the back button on the hardware, the page returns to ‘WelcomePage’. How about when ‘HomePage’ can not return to ‘WelcomePage’?

Thank you

May be something like below mentioned code would work for you. You just need to put condition for which page currently looking at.

platform.ready().then(() => {
          // Okay, so the platform is ready and our plugins are available.
          // Here you can do any higher level native things you might need

          platform.registerBackButtonAction(() => {
            else if(this.nav.canGoBack()){
              //don't do anything

thank you for replying, but I found my own solution by updating the ionic project to the latest version

the other solution was to set the RootPage by login, and to come back to default if user was not logged in. (that’s what i do in my app).

Have fun with ionic,