bug: Hardware Back Button control on Android does not work well. However, if there is no screen transition.
See original GitHub issueBug Report
Ionic version:
[x] 5.1
Current behavior:
On Android, pressing the back button on the first page of a project always causes the app to close. This happens absolutely even if the control of the back button is overridden so as not to quit the application according to the following Hardware Back Button. However, once you have moved to another screen, the app will not exit even if you go back to the first page and press the back button. https://github.com/ionic-team/ionic-docs/blob/master/src/pages/developing/hardware-back-button.md
Expected behavior:
Even if the screen transition is not performed, the overwriting process of Hardware Back Button is executed and the application is not terminated.
Steps to reproduce:
Related code:
I’ve pushed a sample below. https://github.com/masatada-kurihara/ionic-back-button-test
The overwriting process of the back button is described in the NgOninit of HomePage, but the moment I start the application, the process is not executed. After the transition to FugaPage, the back button overwriting process is enabled.
Other information:
Probably not occurring in ionic4.8.1.
Ionic info:
Ionic:
Ionic CLI : 6.8.0 (/Users/masatada.kurihara/.nvm/versions/node/v12.9.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.1.0
@angular-devkit/build-angular : 0.803.26
@angular-devkit/schematics : 8.3.26
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run (update available: 1.0.0) : 0.2.8
System:
Android SDK Tools : 26.1.1 (/Users/masatada.kurihara/Library/Android/sdk)
ios-deploy : 1.9.4
NodeJS : v12.9.1 (/Users/masatada.kurihara/.nvm/versions/node/v12.9.1/bin/node)
npm : 6.13.7
OS : macOS Catalina
Xcode : Xcode 11.4.1 Build version 11E503a
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
@liamdebeasi It was a problem with the cordova-plugin-splashscreen. https://github.com/apache/cordova-plugin-splashscreen/issues/186
Thanks for the follow up. I tried your application on a Pixel 3 running Android 9 and a Pixel XL Running Android 10 with Capacitor and Cordova.
I was unable to reproduce this behavior on any device running Capacitor, but I was able to reproduce this behavior on Android 9+ only when using Cordova. This sounds like a Cordova bug, so I would recommend you file an issue with the project maintainers. Thanks!