[SOLVED] How to exit the app please?

I’m under Ionic v4, and I would like to exit the application from JavaScript.
All solutions found on this forum or on Google doesn’t seems to works:

=> ERROR in src/app/home/home.page.ts(69,5): error TS2304: Cannot find name ‘ionic’

=> ERROR in src/app/home/home.page.ts(71,10): error TS2339: Property ‘platform’ does not exist on type ‘HomePage’.

=> compilation OK, but in JS the navigator[‘app’] is undefined

I’ve also tried the plugin cordova-plugin-exit, but the author doesn’t known how this could works with Ionic v4

I need a solution that works from Android 5.0 please. Thanks for your help!

Hello, here in this app i solved exit app error, it’s ionic 4 and it’s working in 5 too.

Thank for your help @gokujy but this still doesn’t works. You use one of the methods I’ve listed in my post, this one:

But nothing happen when I click on my button to execute this code in my emulator :frowning:

Okey i will try later today and will let you know if i solve

1 Like

Hi, i am testing this plugin ionic 4, don’t know why but exit app is working.

1 Like

Waouhhh you’re my hero!!
This works, but WTF! Why this only works if I add this rate plugin ?!
I suspect it’s not this plugin, but the dependencies of this plugin!
THANK YOU :smiley:

1 Like

Hola @noxdigital y @gokujy que pena es que también tengo el mismo problema pero no logro conseguir que mi app se salga al presionar el botón salir de mi mobil android, ¿podrían ayudarme por fa? soy nuevo en esto :frowning:

Hello, If you still having exit app issue ping me