Last active
February 20, 2024 13:48
-
-
Save LeMiira/325a13245707081ac87cfb542e0f5d2c to your computer and use it in GitHub Desktop.
capicator commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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