Channels
Channels let you manage updates across different environments (development, staging, production) and target specific user groups or separate applications.
Overview
Channels work for both environment management and multi-app scenarios. You can use them to separate environments like dev, staging, and production, or to manage completely different apps (e.g., app2, app3, app4) with their own channels.
- Default Channel: Apps use the
productionchannel when no channel is specified. - Environment Management: Separate your environments (
dev,staging,production) to control which updates go where.
Setting Up Channels
1. Specify Channel in Configuration File
Use the hot-updater channel set command to specify your desired channel.
npx hot-updater channel set <channel>This command will modify the native project files for you. Here's what changes:
<key>HOT_UPDATER_CHANNEL</key>
<string>your_set_channel</string> <resources>
<string name="app_name">HotUpdaterExample</string>
<string name="hot_updater_channel" moduleConfig="true">your_set_channel</string>
</resources>For Expo, you need to add the channel to the plugin configuration in your app.json file.
{
"expo": {
"plugins": [
[
"@hot-updater/react-native",
{
"channel": "<your-channel-name>"
}
]
]
}
}Replace <your-channel-name> with your desired channel (e.g., production).
After modifying app.json, run prebuild to apply the changes to the native projects.
npx expo prebuild --cleanCustom Configuration Paths
For projects with non-standard structures or iOS app extensions, you can configure custom paths for platform-specific configuration files in your hot-updater.config.ts:
import { defineConfig } from "hot-updater";
export default defineConfig({
// ... other configurations
platform: {
ios: {
infoPlistPaths: [
"ios/YourApp/Info.plist",
"ios/YourAppExtension/Info.plist", // Include extension Info.plist
"ios/NotificationService/Info.plist"
]
},
android: {
stringResourcePaths: [
"android/app/src/main/res/values/strings.xml",
"android/app/src/debug/res/values/strings.xml" // Include additional resource files
]
}
}
});This is useful when:
- Your iOS project has app extensions (widgets, share extensions, notification services)
- You have multiple Android build variants with different resource paths
- Your project doesn't follow the standard React Native file structure
Important: Configure these custom paths before running hot-updater channel set commands to ensure all relevant files are updated with the new channel.
2. Rebuild App with New Channel
After setting the channel, rebuild your app in Release mode:
iOS:
cd ios && pod install && cd ..
npx react-native run-ios --mode ReleaseAndroid:
npx react-native run-android --mode ReleaseiOS:
npx rock run:ios --configuration ReleaseAndroid:
npx rock run:android --variant ReleaseiOS:
npx expo run:ios --variant releaseAndroid:
npx expo run:android --variant release3. Specify Channel Deployment
You can also specify the target channel directly during deployment:
npx hot-updater deploy -p <"ios" | "android"> -c "<channel>"Replace <channel> with your target channel name (e.g., dev, staging, production).
Retrieving the Current Channel
Use the HotUpdater.getChannel() function to retrieve the current release channel within your app.
We recommend displaying this value in your app UI to visually confirm that it's using the intended update channel.
Example Usage
import { HotUpdater, getUpdateSource } from "@hot-updater/react-native";
import { Text, View } from "react-native";
function App() {
const channel = HotUpdater.getChannel();
return (
<View>
<Text>Current Channel: {channel}</Text>
</View>
);
}
export default HotUpdater.wrap({
source: getUpdateSource("<your-update-server-url>", {
updateStrategy: "appVersion", // or "fingerprint"
}),
})(App);Channel Behavior
- Defaults to
productionif no channel is specified. - Channels ensure separation of different environments (e.g.,
dev,staging,production) to apply updates accurately. - Updates can subsequently be deployed using
hot-updater deploy -c <channel>. - Important: Changing the channel requires rebuilding the native app; simply altering the configuration file or deployment commands will not affect an already built app.