REVEB
January 26, 2024, 11:28pm
1
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
franse
January 26, 2024, 11:44pm
2
Can you try to change CapacitorApp.exitApp();
To Capacitor.Plugins.App.exitApp();
REVEB
January 26, 2024, 11:45pm
3
ok I will do that now and update you
REVEB
January 27, 2024, 12:00am
4
Thank you very much @franse . It is working fine now
franse
January 27, 2024, 12:07am
5
It’s a pleasure, seems I need to edit the tutorial, so thanks for noticing it
You can also use Capacitor.Plugins.App.minimizeApp();
1 Like