跳过内容

设置

GitHub

为了对更新系统有更细致的控制,您可以使用这些设置来配置它:

允许插件从JavaScript端动态修改updateUrl、statsUrl和channelUrl。

适用于Android、iOS和Electron。

默认值: false

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"allowModifyUrl": true
}
}
}

配置应用ID

适用于Android、iOS和Electron。

默认值: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"appId": "com.example.app"
}
}
}

配置 native 插件在考虑更新失败之前等待的毫秒数。

适用于 Android、iOS 和 Electron。

默认值: 10000 10 秒

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"appReadyTimeout": 1000
}
}
}

autoDeleteFailed

自动删除失败

配置插件是否自动删除失败的包。

适用于 Android、iOS 和 Electron。

默认值: true

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"autoDeleteFailed": false
}
}
}

配置插件是否在更新成功后自动删除之前的捆绑包。

可用于 Android、iOS 和 Electron。

默认值: true

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"autoDeletePrevious": false
}
}
}

在使用即时应用模式时,自动处理启动屏幕隐藏。启用后,插件将在更新应用或无需更新时自动隐藏启动屏幕。 这消除了手动监听 appReady 事件并调用 SplashScreen.hide() 的需要。 仅在 autoUpdate 设置为 "atInstall", "onLaunch",或者 "always". Legacy directUpdate values are still supported for backward compatibility. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Requires Auto Update to be enabled.

需要安装并配置 @__CAPGO_KEEP_0__/splash-screen 插件,launchAutoHide: false。

需要启用自动更新。 false

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"autoUpdate": "atInstall",
"autoSplashscreen": true
}
}
}

复制到剪贴板 periodCheckDelay 标题为“autoUpdate” true 配置插件如何检查、下载和应用实时更新。 "atBackground" 插件在应用切换到前台时检查更新,并在应用保持打开时重复定时器检查更新。 false"off"。 将字符串值合并到之前的自动更新和直接更新配置中。

选项:

  • "off"false: 禁用自动更新检查
  • "atBackground"true: 每次前台检查时自动检查并下载更新,然后在下一次应用切换到后台时应用更新
  • "atInstall": 只在首次安装或原生应用商店更新后立即应用;否则使用 "atBackground" 行为
  • "onLaunch": 只在从杀死状态(冷启动)将应用带到前台时立即应用。第一次检查后,切换到 "atBackground" 行为
  • "always": 每次前台转换时检查,并在有更新时立即应用
  • "onlyDownload": 自动检查和下载,触发 updateAvailable, 并且永远不会自动设置下一个捆绑包或应用更新

可在 Android、iOS 和 Electron 上使用。

默认值: "atBackground" (true 仍然被接受)

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"autoUpdate": "onlyDownload"
}
}
}

配置频道操作的 URL / 端点。

可在 Android、iOS 和 Electron 上使用。

默认值: https://plugin.capgo.app/channel_self

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"channelUrl": "https://example.com/api/channel"
}
}
}

defaultChannel

标题:默认频道

在配置中设置应用的默认频道。区分大小写。 此设置将覆盖云端设置的默认频道,但仍会尊重云端设置的覆盖。

可在 Android、iOS 和 Electron 上使用。

默认值: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"defaultChannel": "production"
}
}
}

已弃用。请使用 autoUpdate"atInstall", "onLaunch"。 此选项仍支持现有应用。 "always"Deprecated. Use string modes instead: , or . This option remains supported for existing apps.

选项:

  • false:永不进行直接更新
  • 'atInstall':与 autoUpdate: "atInstall"
  • 'onLaunch':与 autoUpdate: "onLaunch"
  • 'always':与 autoUpdate: "always"
  • true(已弃用)与 "always" 为了向后兼容

可用于 Android、iOS 和 Electron。

默认: false

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"autoUpdate": "atInstall"
}
}
}

Disable JavaScript插件的日志记录。如果为true,插件将不会在JavaScript控制台中记录日志。只有原生日志会被执行。

可用于Android、iOS和Electron。

默认: false

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"disableJSLogging": true
}
}
}

配置插件以在重新加载后保留URL路径。

可用于Android、iOS和Electron。

默认: false

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"keepUrlPathAfterReload": true
}
}
}

配置周期更新检查的延迟时间。单位为秒。不能小于 600 秒(10 分钟)。

可在 Android、iOS 和 Electron 上使用。

默认: 600 (10 分钟)

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"periodCheckDelay": 600 // (10 minutes)
}
}
}

配置用于端到端实时更新加密(版本 2)的公钥。可在 Android、iOS 和 Electron 上使用。

periodCheckDelay

Default: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"publicKey": "YOUR_PUBLIC_KEY"
}
}
}

resetWhenUpdate

标题:重置更新

在设备安装新版本的原生应用程序包时,自动删除之前下载的捆绑包。

适用于Android、iOS和Electron。

Default: true

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"resetWhenUpdate": false
}
}
}

responseTimeout

标题:响应超时

配置原生插件在等待API超时之前等待的毫秒数。

适用于Android、iOS和Electron。

Default: 20 (20 秒)

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"responseTimeout": 10 // (10 seconds)
}
}
}

通过摇动手指来显示用于调试/测试目的的更新菜单。

可用于 Android、iOS 和 Electron。

Default: false

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"shakeMenu": true
}
}
}

配置用于发送更新统计信息的 URL/端点。

可在 Android、iOS 和 Electron 上使用。设置为 "" 以禁用显式统计报告通过 /stats.

禁用 statsUrl 不禁用所有 Capgo 设备存储。 如果 updateUrl 仍然启用 /updates 仍然存储计费 MAU 行、设备库存和更新决策事件数据以服务更新和计算 MAU。 请参阅 合规性 详细了解字段级别的分解。

默认: https://plugin.capgo.app/stats

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"statsUrl": "https://example.com/api/stats"
}
}
}

配置更新检查发送到的 URL / 端点。

可在 Android、iOS 和 Electron 上使用。

默认: https://plugin.capgo.app/updates

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"updateUrl": "https://example.com/api/auto_update"
}
}
}

配置当前应用的版本。这将用于第一个更新请求。 如果未设置,插件将从本机 code 中获取版本。

可在 Android、iOS 和 Electron 上使用。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"version": "1.0.0"
}
}
}

配置CLI以使用本地api进行测试。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"localApi": "http://localhost:54321/functions/v1"
}
}
}

配置CLI以使用本地文件api进行测试。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"localApiFiles": "http://localhost:54321/functions/v1/files"
}
}
}

配置CLI以使用本地服务器进行测试或自主托管更新服务器。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"localHost": "http://localhost:5173"
}
}
}

配置CLI使用本地服务器进行测试或自托管更新服务器。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"localSupa": "http://localhost:54321"
}
}
}

配置CLI使用本地服务器进行测试。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"localSupaAnon": "YOUR_LOCAL_ANON_KEY"
}
}
}

配置CLI以使用本地服务器进行测试或自托管更新服务器。

默认: undefined

capacitor.config.json
{
"plugins": {
"CapacitorUpdater": {
"localWebHost": "http://localhost:5173"
}
}
}

这些设置可以在不需要发布原生应用程序的情况下根据频道进行配置。继续从设置中

继续从设置中

如果您正在使用 设置 以计划仪表板和API操作,连接它 使用@capgo/capacitor-updater 使用@capgo/capacitor-updater的本地能力 API概述 API概述的实现细节 介绍 介绍的实现细节 API密钥 API密钥的实现细节 设备 设备的实现细节