跳转到内容

频道

当设备向 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) 此页面应该看起来像这样:

manage channel

Let’s go through the different sections.

First the Bundle number (1 in the image). This is the current version for that channel. When asked to serve an update this channel will always attempt to respond with that version.* [^1] Clicking on it should take you to the bundle page.

Second the Shared to (2 in the image) page. I recommend against ever using this. A new and better system is in the works.

Now the forced devices (3 in the image). This is a list of devices that will always get updates from this channel. This is useful for testing purposes. You can add force a device to a channel from the devices page.

Lastly the settings (4 in the image). This is where you can manage how the channels behave. After you click on it you should see something like this:

setting of channel

The list of settings is long, but I will do my best to explain them all.


First the Default channel THIS IS PROBABLY THE MOST IMPORTANT ONE.
If a channel is marked as default, then it will be used as the default channel for all new devices.
In different terms: If you have a new user Capgo will try to serve them the latest version of this default channel (unless the device is forced or has an override as described above). Only 1 channel can be set to default at a time. If you try to break this rule you will be asked to confirm your action.

confirm make change

After you confirm the old default channel will be unmarked as default and the new one will be marked as default.


Second the IOS setting. This is relatively simple. If this is false then IOS devices will not be allowed to download updates from this channel.

Third is the Android setting. This is similar to IOS. If this is false then Android devices will not be allowed to download updates from this channel.

Fourth is the Disable auto downgrade under native setting. If this is true then it will be impossible to downgrade from a native version. This means that if you have uploaded a 1.2.0 version to the app store or play store and try to set the channel version to 1.1.0 then the update (downgrade) will fail.

Fifth is the Disable auto update. This setting is quite complex, and you can learn more about it here

As for Allow development build. If this is true then development builds will be allowed to download updates from this channel. If not then any update request that has the prod set to false will be rejected. This is mostly useful for testing purposes.

Seventh is the Allow Emulators. If this is false then Capgo will disallow any update request that comes from an emulator. This is mostly useful for testing purposes.

Eight is the Allow devices to self associate. If this is true then the setChannel method will be available. If this is set to false and you try to call the setChannel method with this channel then the call will fail.