bug: Hardware back button closes app on Android
See original GitHub issueBug Report
Ionic version:
[x] 5.x
Current behavior:
When pressing the hardware back button on an Ionic app before doing anything else, it will close the app. This does not happen if you interact with the app in any way first, like touching somewhere on the screen.
Expected behavior:
I would expect the app to not close?
Steps to reproduce:
- Create a new cordova project with ionic cli
- Run ionic cordova run android
- Press hardware back button
- App should now close
Related code:
Other information:
I do not know if this is an Ionic issue or if the problem lies somewhere else, but I thought I would give a heads up. Also this doesn’t seem to be listed in the hardware back button consolidated list of issues.
Ionic info:
Ionic:
Ionic CLI : 6.13.1 (C:\Users\<user>\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 5.6.4
@angular-devkit/build-angular : 0.1102.8
@angular-devkit/schematics : 11.2.8
@angular/cli : 11.1.4
@ionic/angular-toolkit : 3.1.1
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run : 1.3.0
System:
Android SDK Tools : 26.1.1 (C:\AndroidSDK)
NodeJS : v15.11.0 (C:\Program Files\nodejs\node.exe)
npm : 7.6.0
OS : Windows 10
Issue Analytics
- State:
- Created 2 years ago
- Comments:24 (12 by maintainers)
Top Results From Across the Web
Ionic Capacitor hardware back button is automatically closing ...
//back button handle //Registration of push in Android and Windows ... The Problem is, when I build a release app, it still closes...
Read more >Android Back Button causes crashing/closing - sometimes
bug. Pressing the Back key will close/crash my app about 50% of the time. I am able to reproduce this issue using the...
Read more >Back button issues - Samsung Members Community
Hi, I am having issues with my back button not working as it should. Sometimes when I press the back button it completely...
Read more >App destroyed after back button pressed - Ionic Native
I Used IONIC 5 and ANgular 11 ,. When I click on the Bakc button the application close automatically. I see only this...
Read more >Android back button should close the selected tab and return ...
In the Android native UI, when I select menu->More->Add-ons, about:addons opens in a new tab in my browser. I then click the back...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can reproduce this behavior, though only on newer versions of Android. In addition, I can reproduce this in a regular Angular app without Ionic Framework, so I need to do some more digging to see what could be causing this issue.
No problem, glad the issue is resolved 😄