Channels
Channels help manage updates across different environments (development, staging, production) and deliver updates to specific user groups or separate applications.
Channels are not limited to environment management alone—they also support managing multiple apps distinctly (e.g., app2, app3, app4), each using its own dedicated channel.
Channel Overview
- Default Channel: Apps default to the
production
channel if no channel is specified.
- Environment Management: Clearly separates different environments (
dev
, staging
, production
) to ensure accurate application of updates.
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:
ios/HotUpdaterExample/Info.plist
<key>HOT_UPDATER_CHANNEL</key>
<string>your_set_channel</string>
Custom 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
:
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 specifying the new channel, rebuild your native app:
cd ios && pod install && cd ..
npx react-native run-ios --mode Release
3. 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
production
if 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.