Android hardware back button

With beta 7, when nav.canGoBack() is false, app always gets closed … any idea?

hey guyzss i tried to handle hardware back button for android but i couldn’t get success… please help me.

code i used

platform.registerBackButtonAction(() => {
console.log(‘in app.ts’);

i write above code in all page… is there any problem if i write in all page?

You haven’t provided a priority for the action. According to the docs for registerBackButtonAction() at Platform - Ionic API Documentation - Ionic Framework

Registering a hardware back button action and setting a priority allows apps to control which action should be called when the hardware back button is pressed. This method decides which of the registered back button actions has the highest priority and should be called.

You would need to do it like this:

this.platform.registerBackButtonAction(() => {
  // action here...
}, 100);

hi Klasu,

I just want to close the user login page, how can I do that

@varshil29 I also want to do similar thing. Have you resolved this ?