0
How do I allow the physical button come back of the mobile carries out a certain function in the Ionic 3? (In this case, a function that makes the application open the home page)
0
How do I allow the physical button come back of the mobile carries out a certain function in the Ionic 3? (In this case, a function that makes the application open the home page)
1
Good afternoon Teiji, you can use the Platform service, with it you can register the action of the button with a function, for example:
export class AnyPage{
constructor(private navCtrl: NavController,
private platform: Platform) {
this.platform.registerBackButtonAction(() => {
this.navCtrl.pop();
});
}
}
From that moment, whenever you press the physical button of the phone, it will run the this.navCtrl.pop()
, but I don’t know if using Native Transitions the Navcontroller action will be useful.
Browser other questions tagged ionic apache-cordova mobile
You are not signed in. Login or sign up in order to post.
You want to change the default function of the back button?
– Israel Merljak
@Israelmerljak In fact, the only function it performs in my app (the button physical) is to close the app on any page that is, I would like it to exercise the most "common" function of it which is to go back to the previous page of the app.
– Teiji Watanabe
Strange that. maybe it’s the way of navigation you’re using, because usually the functionality is just this, remove the current view and go to the previous one.. of a read in the Ionic documentation on the service Platform
– Israel Merljak
So I’m using Native Transitions, maybe that’s why. Anyway, is there any way to make the physical button have utility that I even wish with the way of browsing other than default?
– Teiji Watanabe