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 in ionic 4 #18140

Closed
kushalkulle opened this issue Apr 26, 2019 · 2 comments
Closed

bug: hardware back button in ionic 4 #18140

kushalkulle opened this issue Apr 26, 2019 · 2 comments
Labels

Comments

@kushalkulle
Copy link

this.platform.backButton.subscribeWithPriority(0 ,() => {
// close action sheet
this.routerOutlets.forEach((outlet: IonRouterOutlet) => {
this.appExit();
if (outlet && outlet.canGoBack()) {
outlet.pop();
}
});
});

async appExit(){
const alert = await this.alertController.create({
header: 'App termination',
message: 'Do you want to close the app?',
buttons: [{
text: 'Cancel',
role: 'cancel',
handler: () => {
console.log('Application exit prevented!');
}
}, {
text: 'Close App',
handler: () => {
navigator['app'].exitApp(); // Close this application
}
}]
});
return await alert.present();
}

Apart from this, tried with other ways from Stackoverflow and other forums too. Still unable to solve. Hope I get support from Ionic team ASAP.

These dependencies are using in my applications.

"dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/fire": "^5.1.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/app-minimize": "^5.5.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/google-plus": "^5.3.0",
"@ionic-native/network": "^5.5.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.0.0",
"@ionic/storage": "^2.2.0",
"cordova": "^9.0.0",
"cordova-android": "7.1.4",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-googleplus": "7.0.1",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"core-js": "^2.5.4",
"firebase": "^5.9.2",
"moment": "^2.24.0",
"rxjs": "~6.3.3",
"zone.js": "~0.8.29"
}

@ionitron-bot ionitron-bot bot added the triage label Apr 26, 2019
@liamdebeasi
Copy link
Contributor

Hi there,

Thanks for the issue. I am going to close this as a duplicate of #16611. Note: This is a collection of multiple issues, but the issue you describe is under the Cordova/App section.

Thanks!

@ionitron-bot
Copy link

ionitron-bot bot commented May 26, 2019

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 May 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants