跳过内容

手动更新

GitHub

在你的 capacitor.config.json, 来禁用自动更新。

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

你可以使用这个例子或重新创建逻辑在你的应用中。

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

继续手动更新

手动更新

如果您正在使用 手动更新使用@capgo/capacitor-updater for the native capability in Using @capgo/capacitor-updater, Capgo企业版 for the product workflow in Capgo Enterprise, Page/area: 企业产品/定价页面。角色: 短的UI标签或导航项。见于: 企业版.astro。保留Capgo产品/品牌和开发者术语完全不变。 使用@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-updater 为产品工作流程在Capgo企业版, 为Capgo Alternatives产品工作流程 Capgo 咨询 为Capgo 咨询产品工作流程