跳转到内容

频道

当设备向 Capgo 请求更新时,将按以下顺序决定使用的频道(优先级从高到低):

  1. 强制设备映射: 如果设备 ID 明确强制到某个频道(请参阅频道设置中的强制设备列表),则该频道始终优先。
  2. 云覆盖(由 setChannel() 或 Web 应用操作创建): 调用 setChannel(或在仪表板中更改设备的频道)会在云中写入与该设备 ID 绑定的持久覆盖。该覆盖在强制映射之后但在任何默认值之前被查询。重新安装应用不会清除它;删除设备条目会清除。
  3. Capacitor 配置 defaultChannel(测试构建默认值): 对于内部/beta/测试构建,您可以在 capacitor.config.* 中设置 defaultChannel(旧键 channel),以便测试设备从预发布频道开始(例如 betapr-123)。如果不存在,设备将进入云默认值。生产构建通常不设置此项。
  4. 云默认频道(约 99% 用户的主要策略): 几乎所有真实用户都会进入的主要生产频道。任何没有强制、没有覆盖且没有配置 defaultChannel 的新设备都使用此频道。更改它会在几秒钟内为所有人推出(或回滚)——无需新的二进制文件。

为什么云默认是主要路径:

  • 无需重新构建或重新发布原生二进制文件即可立即推出或回滚。
  • 一个地方管理 iOS 和 Android 行为。
  • 更安全:您可以在切换默认值之前确认 bundle 存在且设置正确。
  • 可审计的更改(团队成员可以在 UI/日志中看到谁更改了什么)。 设计原则:上层(强制/覆盖/配置)是例外(调试单个用户、QA 切换、测试构建默认值)。普通用户流向云默认值。

Changing the cloud default channel affects new normal devices that:

  • Are not forced
  • Do not already have a cloud override
  • Do not have an app-level defaultChannel defined

If a test build ships with defaultChannel: 'beta' and you later change the cloud default to production, devices that started on beta via the config stay there until you: (a) override them with setChannel(), (b) force them, or (c) delete the device entry.

Devices stay on their current channel unless you:

  • Force them to another channel.
  • Call setChannel() (creating/replacing the cloud override) or change it manually in the dashboard.
  • Remove / archive the channel they are on (then they will fall back through the precedence again at next check).

If a channel is disabled for a platform (see iOS / Android toggles) and would otherwise have been selected, the selection skips it and falls back to the next rule.

Note: Setting defaultChannel means changing it requires a new binary; use it intentionally for test/QA, not for general production control.

capacitor.config.ts
// Example: a TestFlight or internal QA build defaults to the beta channel.
const config = {
plugins: {
Capgo: {
defaultChannel: 'beta', // Test build default. Omit in production so users attach to cloud default.
// legacy key: channel
},
},
};
export default config;

If you later change the dashboard default to production, devices already on another channel (via config, override, or force) will NOT move automatically; only fresh devices (or those whose override/force you clear) pick it up.


首先,让我们看一下频道页面。您可以通过点击您的应用然后点击频道标签来访问它。

频道列表

如您所见,右下角有一个加号按钮。(图中的 1)点击它将打开一个模态框,您可以在其中创建新频道。

新频道

然后,在您点击 添加 后,列表中应该会出现一个新频道。

频道创建后

有时频道的配置无效。在这种情况下,您会收到一个大警告,配置错误 列会对一个或多个频道显示 。 您可以在此处了解更多信息

删除频道很简单。只需点击垃圾桶图标并确认删除即可。(图中的 2)

点击频道名称将打开一个模态框,您可以在其中管理频道设置(图中的 3)。

频道设置

频道设置页面包含频道的所有配置选项。让我们逐一了解每个设置。


首先是默认频道切换开关。启用后,此频道将成为新设备的默认频道。有关默认频道工作方式的完整说明(包括如何设置特定平台的默认值,一个用于 iOS,一个用于 Android),请参阅默认频道配置部分。


第二是 IOS 设置。这相对简单。如果设为 false,则 iOS 设备将无法从此频道下载更新。

第三是 Android 设置。这与 IOS 类似。如果设为 false,则 Android 设备将无法从此频道下载更新。

第四是禁用原生版本以下的自动降级设置。如果设为 true,则无法从原生版本降级。这意味着如果您已将 1.2.0 版本上传到 App Store 或 Play Store 并尝试将频道版本设置为 1.1.0,则更新(降级)将失败。

第五是禁用自动更新。此设置相当复杂,您可以在此处了解更多信息。

关于允许开发构建。如果设为 true,则开发构建将被允许从此频道下载更新。否则,任何将 prod 设置为 false 的更新请求都将被拒绝。这主要用于测试目的。

第七是允许模拟器。如果设为 false,则 Capgo 将拒绝来自模拟器的任何更新请求。这主要用于测试目的。

第八是允许设备自行关联。如果设为 true,则 setChannel 方法将可用。如果设为 false 并且您尝试使用此频道调用 setChannel 方法,则调用将失败。