using ionic 4 i have created an application in that i need to control back button. I have used the following code
this.backButtonSubscription =
this.platform.backButton.subscribeWithPriority(1, async () => {
if (this.router.url === '/registration') {
navigator['app'].exitApp();
}
});
This subscription event is working only on root page and not working on other pages.
I want to control the back button on particular page to show alert and other things, but right now when clicking hardware back button in android device it goes to the previous page.