-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4: Android hardware back button doesn't work #14803
Comments
Are there any updates about this bug? |
Will it be supported by default in Ionic 4 or are the developers supposed to use approach like this https://stackoverflow.com/a/51729093/2755616 |
@pvskasyrskiy @artemtool the workaround mentioned by @naveedahmed1
Was just confirmed working |
Works for me but just for pages outside of the tabs page? Inside tabs page I have 4 additional router-outlets how to handle this navigation stack? |
There are other cases as well, such as Back button for modal does't work either. Just keep this in mind that the solution on stackoverflow is a temporary fix. we should wait for permanent fix from ionic team, which I believe should cover all cases and should be available in next updates. |
Just to bring it into notice, the fix should work for the nested router outlets as well. For example for the cases where app component has:
and a component A is rendered in this outlet which also has a router outlet for child components
|
for pages inside the TabsPage it is not working for me. I added this workaround in the TabsPage instead:
|
also ionic 4 cant close app, how to solved it? |
Back button should be the priority of the Ionic's dev team |
I guess it has been fixed recently? dfac9dc |
@borgogelli see how many commits they did about that subject recently, it definitely looks like it's one of their priorities @crebuh for me it worked with modals but not yet with navigation #15492 |
Try This:
Update: it's work for me. |
|
this.platform.exitApp(); doesn't work for ionic v4.1.2 |
replace this.platform.exitApp() and use navigator['app'].exitApp(); // work for ionic 4 |
navigator['app'].exitApp(); how yo setup it? |
@manucorporat PR #15615 fixes the remaining problem with the handler registered by |
The temporary fix from @Riyaz0001 worked for me. However when there are controls on the page I go back to via the physical back button, the first tap on a control does not work. For example a plain ion-button:
I have to tap it twice in order for doit() to be called. It does not happen, when I got back with the |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Bug Report
Ionic Info
Run
ionic info
from a terminal/cmd prompt and paste the output below.Describe the Bug
Android hardware button doesn't work as intended. It seems to be because of back button behavior overriding in generated cordova.js:
which is caused by:
https://github.com/ionic-team/ionic/blob/181cd559cc68542d48a33e6ff58408e2ffc2077c/angular/src/providers/platform.ts#L42
Steps to Reproduce
Steps to reproduce the behavior:
Expected Behavior
Android hardware back button should return the previous page or exit app.
The text was updated successfully, but these errors were encountered: