Ionic version:
Ionic:
ionic (Ionic CLI) : 4.11.0
Ionic Framework : @ionic/angular 4.1.1
@angular-devkit/build-angular : 0.13.5
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.5
@ionic/angular-toolkit : 1.4.0
Cordova:
cordova (Cordova CLI) : 9.0.0
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (an
d 7 other plugins)
System:
NodeJS : v10.15.3
npm : 6.4.1
OS : Windows 7
Current behavior:
I try to use navigator['app'].exipApp() to exit app,but nothing happend
Expected behavior:
do navigator['app'].exipApp() and exit app
Steps to reproduce:
Related code:
this.platform.backButton.subscribe(() => {
if (this.router.isActive('/home', true)) {
if (click_times === 0) {
this.toastService.info('click again to exit app');
click_times++;
setTimeout(() => {
click_times--;
}, 2000);
} else {
try {
//expect to exit app, but first time is nothing happend, second time catch error
navigator['app'].exipApp();
} catch (e) {
console.log(e);
}
}
} else {
this.goBackService.goBack();
}
});
Other information:
I use chrome://inspect/#devices to debug apk and find that at first time do the action navigator['app'].exipApp(),it has no error ,but nothing happend.
And when I do navigator['app'].exipApp() again ,the code catch error :
TypeError: navigator.app.exipApp is not a function
Also,I try to build release apk,and it doesn't work as before
Ionic info:
TypeError: navigator.app.exipApp is not a function
Try to use .exitApp(); instead of . exipApp() :)
Hi there,
Thanks for the issue. As @bastyen noted, it should be navigator['app'].exitApp() instead of navigator['app'].exipApp().
Additionally, this is not something that Ionic Framework manages, so I am going to close this issue. For further questions feel free to post on our forum or our slack.
Thanks for using Ionic!
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.
Most helpful comment
Try to use .exitApp(); instead of . exipApp() :)