Channel Surfing with Capacitor Live Updates¶
Need to deliver beta builds to testers, target updates by app version, or A/B test features — all without a new app store release? Channel surfing with the Live Update plugin lets you switch between update channels on the fly and deliver different app experiences to different user segments.
What is Channel Surfing?¶
Channel surfing is the ability to dynamically switch between Live Update channels at runtime. Instead of hardcoding a single channel name in your app, you can programmatically change which channel your app receives updates from based on user preferences, app version, or other criteria.
This feature unlocks powerful use cases:
- Beta Testing: Let users opt-in to beta features by switching to a
betachannel - Version-Specific Updates: Automatically target the right channel based on your app's native version code
- A/B Testing: Deliver different experiences to different user segments
- Rollback Strategy: Quickly switch users back to a stable channel if issues arise
Enabling Channel Surfing¶
Channel surfing works out of the box with the Capacitor Live Update plugin. Simply use the setChannel(...) method to switch channels, or pass the channel name directly to the sync(...) or fetchLatestBundle(...) methods.
Set a Persistent Channel¶
Use setChannel(...) to persistently change the channel for all future update checks:
import { LiveUpdate } from '@capawesome/capacitor-live-update';
const switchToBeta = async () => {
await LiveUpdate.setChannel({ channel: 'beta' });
// All future sync() calls will use the 'beta' channel
await LiveUpdate.sync();
};
Use a Channel for a Single Update¶
Alternatively, specify the channel directly when checking for updates:
import { LiveUpdate } from '@capawesome/capacitor-live-update';
const checkBetaUpdates = async () => {
const result = await LiveUpdate.sync({ channel: 'beta' });
if (result.nextBundleId) {
console.log('Beta update available');
}
};
Version-Specific Channel Surfing¶
A common pattern is to create channels for each native version code, then automatically switch to the correct channel at runtime. This ensures users only receive updates compatible with their installed app version:
import { LiveUpdate } from '@capawesome/capacitor-live-update';
const syncWithVersionChannel = async () => {
const { versionCode } = await LiveUpdate.getVersionCode();
await LiveUpdate.sync({ channel: `production-${versionCode}` });
};
This approach is recommended for managing binary-compatible updates, as detailed in the Best Practices guide.
Fetching Available Channels¶
Want to let users choose from available channels? You can fetch a list of all channels for your app using the fetchChannels() method:
import { LiveUpdate } from '@capawesome/capacitor-live-update';
const fetchChannels = async () => {
const { channels } = await LiveUpdate.fetchChannels();
return channels.map(channel => channel.name);
};
This returns all channels configured in your Capawesome Cloud app, which you can display to users or use for dynamic channel selection. Please note that the fetchChannels() method is only available in the Live Update SDK version 8.2.0 or later. Alternatively, you fetch the list of channels from the Capawesome Cloud API or hardcode known channel names in your app.
Try Channel Surfing Today¶
Ready to deliver the right updates to the right users? Get started with Capawesome Cloud and the Live Update SDK today.
Conclusion¶
Channel surfing gives you fine-grained control over how you deliver updates to your users. Whether you're managing version-specific updates, running beta programs, or implementing A/B tests, it makes it simple to deliver the right experience to the right users.
To learn more, check out the Live Update plugin documentation and the Best Practices guide. If you're also interested in temporarily pausing updates for specific channels, take a look at the Channel Pausing blog post. If you have any questions, feel free to reach out on the Capawesome Discord server. For the latest updates, subscribe to the Capawesome newsletter.