question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Hardware Back Button control on Android does not work well. However, if there is no screen transition.

See original GitHub issue

Bug 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:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
masatada-kuriharacommented, May 20, 2020

@liamdebeasi It was a problem with the cordova-plugin-splashscreen. https://github.com/apache/cordova-plugin-splashscreen/issues/186

1reaction
liamdebeasicommented, May 12, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: Hardware Back Button control on Android does not work ...
bug: Hardware Back Button control on Android does not work well. However, if there is no screen transition. #21265.
Read more >
How To Fix Back Button Not Working on iPhone and Android
Restart the Device ... Even Android phones with a hardware back button didn't always withstand the worst software bugs. The good news is...
Read more >
Android Home Back Button keys Not Working Damaged
This video will help onhow to solve android Back key Home key, Menu key, recent button not working problemHow to enable soft-keys navigation ......
Read more >
Provide custom back navigation - Android Developers
Back navigation is how users move backward through the history of screens they previously visited. All Android devices provide a Back button for ......
Read more >
Principles of navigation - Android Developers
The Back button appears in the system navigation bar at the bottom of the screen and is used to navigate in reverse-chronological order...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found