registerBackButtonAction exit the app

hello experts,

I was trying registerBackButtonAction on my Exisitng app as well as on new blank app.
but the issue i was facing is that on pressingbackbutton it exits the app but when i minimize the app and then resume my app from recent task then the registerBackButtonAction works well.

this.plt.registerBackButtonAction(() => {
        console.log('Register Back Button works')

Ionic Info


Ionic CLI : 5.4.16 (C:\Users\Fariha\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.9
@ionic/app-scripts : 3.2.4


Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 4 other plugins)


cordova-res : 0.11.0
native-run (update available: 1.0.0) : 0.3.0


NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe)
npm : 6.13.4
OS : Windows 10

Where and When do you run that Code?

Hey @EinfachHans
I run that code in Homepage constructor. Even i tried running that code in app.component.ts under platform ready. But still no luck.actually i want to disable exit on rootpage so that i can use my registerbackbuttonaction


I tried this on my realme c1 and it works goood . but on my honor 9n my app exits but when i try minimizing nd resuming the app it works accordingly to registerbutton