Skip to content

Instantly share code, notes, and snippets.

@temsool
Last active February 20, 2024 13:48
Show Gist options
  • Save temsool/325a13245707081ac87cfb542e0f5d2c to your computer and use it in GitHub Desktop.
Save temsool/325a13245707081ac87cfb542e0f5d2c to your computer and use it in GitHub Desktop.
capicator commands
vue build
npx cap sync
npx cap update
npx cap open android
npm install -g cordova-res
cordova-res android --skip-config --copy
https://stackoverflow.com/questions/67766576/ionic-capacitor-hardware-back-button-is-automatically-closing-the-app
Install capacitor app.
npm install @capacitor/app
Import it.
import { App as CapacitorApp } from '@capacitor/app';
Add back listener if can go back then we can push to back or exit the app.
CapacitorApp.addListener('backButton', ({canGoBack}) => {
if(!canGoBack){
CapacitorApp.exitApp();
} else {
window.history.back();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment