this.platform.backButton.subscribe(() => {
if (this.router.url === '/home') {
if (click_times === 0) {
this.toastService.info('click again to exit app');
click_times++;
setTimeout(() => {
click_times--;
}, 2000);
} else {
try {
navigator['app'].exipApp();
} catch (e) {
console.log(e);
}
}
} else {
this.goBackService.goBack();
}
});
Ionic version:4.11.0
Cordova version:9.0.0
Error Info: TypeError: navigator.app.exipApp is not a function
I use chrome://inspect/#devices
to debug it,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’.
Why?