Ionic4 TypeError: navigator.app.exipApp is not a function


#1
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?


#2

That function does not exist. It was removed from the navigator object years ago.


#3

Sure? I find a lot of example for Ionic 4 (as this: https://geekyminds.co.in/exit-app-on-back-press-ionic-4/) using this function.

P.


#4

I use exipApp instead of exitApp,and it’s ok now.