Skip to content
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

bug: Hardware back-button is not working with default blank template #19763

Closed
indraraj26 opened this issue Oct 27, 2019 · 6 comments
Closed
Labels
package: angular @ionic/angular package type: bug a confirmed bug report

Comments

@indraraj26
Copy link

indraraj26 commented Oct 27, 2019

^^^updated description

Bug Report

Ionic version:

[x] 4.x

Current behavior:

Do we need to add something for root page in app-routing.module.ts or app.component.ts? .Hardware back button is not closing the application as it was in ionic3.

Right now i am using this in my root page to exit the application.

 ionViewDidEnter() {
    this.subscription = this._platform.backButton.subscribe(() => {
      navigator['app'].exitApp();
    });
  }
 
  ionViewWillLeave() {
    this.subscription.unsubscribe();

how can i handle like we used to in ionic 3. Suppose there is slidepage of walk-in which will be root page for new users, after that auth page will be root page then tab page will be root page.

in Ionic 3, we used setRoot to handle in that we never used this kind of hax to handle closing application. Please provide proper way to handle hardware back button.

Thank you.

Expected behavior:

it should close the app.

Steps to reproduce:

SRC : https://github.com/indraraj26/ionic4-back-button
APK: https://github.com/indraraj26/ionic4-back-button/blob/master/app-debug.apk
open below apk in android phone and try to close with back button.

Related code:

insert short code snippets here

Other information:

Ionic info:

D:\ionic4-back-button\blank>ionic info

Ionic:

   Ionic CLI                     : 5.4.4 (C:\Users\indra26\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.11.2
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.3.0
   @capacitor/core : 1.3.0

Utility:

   cordova-res : 0.8.0
   native-run  : 0.2.9

System:

   NodeJS : v10.16.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.9.0
   OS     : Windows 10


D:\ionic4-back-button\blank>
@ionitron-bot ionitron-bot bot added the triage label Oct 27, 2019
@indraraj26
Copy link
Author

ionic-team/ionic-conference-app#707 even in ionic conference app hardware back button is not working in root page, i have just downloaded from playstore.

@liamdebeasi liamdebeasi added package: angular @ionic/angular package type: bug a confirmed bug report labels Oct 28, 2019
@indraraj26 indraraj26 changed the title bug: back-button is not working with default blank template bug: Hardware back-button is not working with default blank template Oct 29, 2019
@indraraj26
Copy link
Author

bump any updates?

@yuvaraj119
Copy link

yuvaraj119 commented Dec 25, 2019

Facing the same issue with ionic-react not able to exit the app any updates?

@yuvaraj119
Copy link

yuvaraj119 commented Dec 30, 2019

I fixed this issue by following this link https://capacitor.ionicframework.com/docs/apis/app for Ionic React

@liamdebeasi
Copy link
Contributor

Hi everyone,

As of Ionic Framework v5.1.0 most of the outstanding hardware back button issues have been resolved. As a result, I am going to close this issue.

To better support the hardware back button integration in Ionic Framework, we launched a dedicated Hardware Back Button Documentation Page that I recommend taking a look at.

If you are still running into issues with the hardware back button on the latest version of Ionic Framework, please create a new issue and include a code reproduction. Thank you!

@ionitron-bot
Copy link

ionitron-bot bot commented Dec 12, 2020

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: angular @ionic/angular package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

3 participants