install ionic capacitor code example

Example 1: ionic capacitor android

// if you didn't run before
ionic build
// then
npx cap add android
npx cap sync

Example 2: ionic capacitor platform web

if (Capacitor.platform !== 'web') {
	// TODO
}

Example 3: how to add capacitor in ionic

cd myApp
ionic integrations enable capacitor

Example 4: start ionic 5 capacitor app

ionic start [appName] [appType] --capacitor

e.g. ionic start myApp blank --capacitor

Example 5: ionic capacitor ios

// if you didn't run before
ionic build
// then
npx cap add ios

Example 6: capasitor with ionic

ionic capacitor build