Back button does not exit App

I am working on a capacitor with bootstrap mobile project and everything seems to be working except the back button on android which do not exit the app even after navigating in history. below is my code to exit the app:

Capacitor.Plugins.App.addListener(‘backButton’, ({canGoBack}) => {

if(!canGoBack){

CapacitorApp.exitApp();

} else {

window.history.back();

}

});

I don’t know but the app do not exit using the back button
Please help me and i will appreciate any suggestions

Can you try to change CapacitorApp.exitApp();
To Capacitor.Plugins.App.exitApp();

ok I will do that now and update you

Thank you very much @franse. It is working fine now

It’s a pleasure, seems I need to edit the tutorial, so thanks for noticing it :slight_smile:
You can also use Capacitor.Plugins.App.minimizeApp();

1 Like