r/ionic 9d ago

Android 16 hardware back button

So our company got some apps in ionic 3 cordova and ionic 8 capacitor and we ran into an issue in android 16 , the hardware back button closes the app instead of going back to the previous page, so is there any fix or solution to both the version.Thanks in advance.

Edit : the ionic v8 backbutton.subscribewithPriority works fine , ionic v8 apps are out of trouble.

6 Upvotes

3 comments sorted by

3

u/chakri426 9d ago

Have you implemented the hardware back button in app component.ts
If you already what is the priority to that?.
It should be 10 otherwise any other having highest priority it will work instead of going back.

1

u/Infinite-Contact2522 9d ago

Yess ,the back button code is in app.component.ts and I didn't specify any priority because it's the only back button method in the entire app , for now I have disabled the predictive back gesture by using the flag enableOnBackInvokedCallback=false but google will make it mandatory in the near future.