How to close mobile app programmatically using IONIC 5?

0

Issue

How to close the mobile app programmatically using IONIC 5? Use case: Upon app start, I am displaying a Terms of Use popover and if the user does not accept, I need to close the app. I am using IONIC5+Angular.

Thank you.

V

Solution

navigator[‘app’].exitApp();

**that’s work for me **

you also use

@capacitor/app

App.exitApp();

Force exit the app. This should only be used in conjunction with the backButton handler for Android to exit the app when navigation is complete.

Ionic handles this itself so you shouldn’t need to call this if using Ionic.

Answered By – 44_Chintan Vasoya

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More