Vai al contenuto

Aggiornamento manuale

GitHub

Aggiungi questo al tuo capacitor.config.json, per disabilitare l'auto-update.

// capacitor.config.json
{
"appId": "**.***.**",
"appName": "Name",
"plugins": {
"CapacitorUpdater": {
"autoUpdate": "off",
}
}
}

Puoi usare questo esempio o ricreare la logica nella tua app.

import { CapacitorUpdater } from '@capgo/capacitor-updater'
import { SplashScreen } from '@capacitor/splash-screen'
import { App } from '@capacitor/app'
let data = {version: ""}
CapacitorUpdater.notifyAppReady()
App.addListener('appStateChange', async(state) => {
if (state.isActive) {
// Do the download during user active app time to prevent failed download
data = await CapacitorUpdater.download({
version: '0.0.4',
url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
})
}
if (!state.isActive && data.version !== "") {
// Do the switch when user leave app
SplashScreen.show()
try {
await CapacitorUpdater.set(data)
} catch (err) {
console.log(err)
SplashScreen.hide() // in case the set fail, otherwise the new app will have to hide it
}
}
})

Se stai usando Aggiornamento manuale per pianificare la migrazione e le operazioni enterprise, collegalo a Usando @capgo/capacitor-updater per la funzionalità nativa in Usando @capgo/capacitor-updater, Capgo Enterprise per il workflow del prodotto in Capgo Enterprise, Alternative ai plugin Ionic Enterprise per il workflow del prodotto nelle alternative ai plugin Ionic Enterprise, Alternative a Capgo per il workflow di prodotto in Capgo Alternatives, e Consulenza Capgo per il workflow di prodotto in Capgo Consulting.