序文
Capgoのアップデートシステムを楽しむようになってから、自分がアプリを作っている自分に「もっと欲しいな」と思うようになった。
私もそう思ったが、Capgoの作者なので、実際に確認することができた。
すべてがオープンソースなので、同じ力をあなたも持っている :)。
Capacitorのアプリ配布プロセスで、他のチームメンバーにアップデートをテストしてもらうのが大きな痛みだ。
TestFlightを使うと、チームに人を集め、使い方を教えるのが時間がかかる。
アップデートをAppleに送ると、BOTによるランダムレビューが行われ、5分か5時間かかることもある。
このBOTレビューで、多くのプレゼンテーションが遅延した。
Googleの場合は、さらに悪い状況だ。生産版をリリースするのに2時間以下かかるが、クローズドベータ版をリリースするのに1–2日かかる。
解決策
Capgoでチャンネルシステムを作り、問題を解決した。
npx @capgo/cli@latest bundle upload -c production すべてのユーザーにアップデートを配信する (プロダクションチャンネルがデフォルトに設定されている場合)
If you do, then the version will land to a different channel, this can be automatized in __CAPGO_KEEP_0__ action npx @capgo/cli@latest bundle upload -c development Then you have 2 way to let users get the updates from the channel GitHub action.
This can be useful when you don’t want to create your own backend for channel set, this is fast to implement.
With that one, the only thing you need to do is allow one of your channels to be self to set.
Allow set self in __CAPGO_KEEP_0__
And then add this in the __CAPGO_KEEP_0__ of your Ionic app, for best experience, use this after the user clicks on a button like “register for beta”

This can be useful for your internal team, this is fast to implement. Allow users to copy their deviceID from your app and send it to you manually, this code will help you to get it:
import { CapacitorUpdater } from '@capgo/capacitor-updater'
const deviceId = await CapacitorUpdater.setChannel({ channel: 'beta' })
Hide a button somewhere in your app, or show the button to only connected users with a
code
import { CapacitorUpdater } from '@capgo/capacitor-updater'
const deviceId = await CapacitorUpdater.getDeviceId()
__CAPGO_KEEP_0__ admin role, for example.
Then Go to the Web app or native app Capgo, connect as app admin, select your app, click on the device list.
Then put in the search bar the deviceID click on the one found and then click on the Channel link choose the development, ask your teammate to open the app again, wait 30 sec and open close.
He should get your version.
Automatic way
This can be useful for your beta testers, this is longer to implement.
Same as the manual way, you have to get the deviceID
import { CapacitorUpdater } from '@capgo/capacitor-updater'
const deviceId = await CapacitorUpdater.getDeviceId()
But this time you have to send it automatically to your backend, I let you decide how you do that.
I will just suggest you to store it in a database, that will facilitate your life later.
Then in your backend you have to send it to Capgo backend too. Below two code examples:
NodeJS
import axios from 'axios'
await axios.post('https://api.capgo.app/device', {
app_id: 'YOUR_APP_ID',
device_id: 'DEVICE_ID',
channel: 'CHANNEL_NAME', // The name of the channel, or undefined if version_id provided
version_id: 'VERSION_NAME' // this is optional, if provide it will override the channel, that useful when you want to debug only one user.
}, {
headers: {
authorization: 'YOUR_API_KEY' // choose a key with 'write' or 'all' rights
}
})
Cloudflare
addEventListener('fetch', (event) => {
event.respondWith(
handleRequest(event.request).catch(
err => new Response(err.stack, { status: 500 })
)
)
})
async function handleRequest(request) {
const { pathname, method } = new URL(request.url)
const body = await request.json()
const newBody = JSON.stringify({
app_id: 'YOUR_APP_ID',
device_id: body.device_id,
channel: 'alpha'
})
const newUrl = new URL('https://api.capgo.app/device')
const options = {
headers: {
authorization: 'YOUR_API_KEY',
},
method: 'POST',
body: newBody
}
if (request.method === 'DELETE') {
// DELETE the channel link
options.method = 'DELETE'
return fetch(newUrl.toString(), options)
}
return fetch(newUrl.toString(), options)
}
ボディにdevice_idを含めてPOSTで送信し、追加と削除のメソッドを使用して追加と削除を行うURLに送信してください。
この設定が完了したら、アプリ内にオプティン用のボタンを追加し、Webアプリで設定が有効になっているかどうかを確認してください。
また、オーバーライドを削除することもできます。 null オーバーライドを削除するには
デバイス上に設定されているオーバーライドを確認するには、同じURLにGETリクエストを送信してください。
import axios from 'axios'
const res = await axios.get('https://api.capgo.app/device?app_id=YOUR_APP_ID&device_id=DEVICE_ID', {
headers: {
authorization: 'YOUR_API_KEY' // choose a key with 'write' or 'all' rights
}
})
console.log('data', res.json())
1つのユーザーまたはグループに特定の更新を送信する方法については、次のステップに進んでください。
チャネルを使用している場合 1つのユーザーまたはグループに特定の更新を送信する方法については、次のステップに進んでください。 チャネルルーティングとステージドロールアウトを計画するには、Cloudflareに接続してください。 チャネル チャネルに関する実装詳細は、チャネルを参照してください。 チャンネル チャンネルの実装詳細について チャンネル チャンネルの実装詳細について ベータテスト ソリューション ベータテスト ソリューションの製品ワークフローについて バージョン ターゲット ソリューション バージョン ターゲット ソリューションの製品ワークフローについて