Zum Inhalt springen

Manuelles Update

GitHub

Füge dies zu deiner capacitor.config.json, um das Auto-Update zu deaktivieren.

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

Du kannst dieses Beispiel nutzen oder die Logik in deiner App nachbauen.

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
}
}
})

Wenn du es nutzt Manuelles Update um Migration und Enterprise-Betrieb zu planen, verbinde es mit Verwendung von @capgo/capacitor-updater für die native Funktion in der Verwendung von @capgo/capacitor-updater, Capgo Enterprise für den Produkt-Workflow in Capgo Enterprise, Ionic Enterprise Plugin-Alternativen für den Produkt-Workflow in Ionic Enterprise Plugin-Alternativen, Capgo Alternativen für den Produkt-Workflow in Capgo Alternativen, und Capgo Consulting für den Produkt-Workflow in Capgo Consulting.