Not work registerBackButtonAction in ionic 2

i want to put event on hardware back button.

code that i used

platform.registerBackButtonAction(function () {
              console.log('At Back Button Pressed home');
              if(menu.isOpen())
              {
                console.log('In menu');
                this.menu.close();
              }
              else{
                 this.nav.pop();  
              }
            }, 1);