Getting Started
Welcome to CodePush Multi-Tenant! This guide will help you get started with deploying over-the-air updates to your React Native applications.
What is CodePush?
CodePush is a service that enables you to deploy mobile app updates directly to your users' devices without going through the traditional app store update process. This allows you to:
- Fix bugs quickly
- Add new features
- Update content
- Make changes without waiting for app store approval
Prerequisites
Before you begin, make sure you have:
- A React Native application (0.60+)
- Node.js installed (version 12 or higher)
- Admin access to your CodePush tenant account
Step 1: Access Your Admin Dashboard
- Navigate to your admin dashboard at
https:/s.codepush.online/api
(or your configured URL) - Sign in with your Firebase credentials
- Create a new app or select an existing one
Step 2: Install CodePush CLI
Install the CodePush CLI globally on your development machine:
npm install -g code-push-cli
Step 3: Configure CodePush Server
Set your CodePush server URL:
code-push login --server https://server.codepush.online
Follow the authentication flow to link your CLI with your account.
Step 4: Register Your App
Register your app with CodePush:
# For iOS code-push app add MyApp-iOS ios react-native # For Android code-push app add MyApp-Android android react-native
Step 5: Install React Native CodePush SDK
In your React Native project directory:
npm install --save react-native-code-push
For React Native 0.60+, the library will be auto-linked. For older versions, follow the manual linking instructions.
Step 6: Configure Your App
iOS Configuration
- Open your iOS project in Xcode
- Add your deployment key to
Info.plist
:
<key>CodePushDeploymentKey</key>
<string>YOUR_IOS_DEPLOYMENT_KEY</string>
Android Configuration
- Open
android/app/src/main/res/values/strings.xml
- Add your deployment key:
<string name="CodePushDeploymentKey">YOUR_ANDROID_DEPLOYMENT_KEY</string>
Step 7: Integrate CodePush in Your App
Add CodePush to your main App component:
import CodePush from 'react-native-code-push';
class MyApp extends Component {
componentDidMount() {
CodePush.sync();
}
render() {
return (
// Your app content
);
}
}
export default CodePush(MyApp);
Step 8: Deploy Your First Update
Make a change to your app (like updating a text string), then deploy:
code-push release-react MyApp-iOS ios code-push release-react MyApp-Android android
Next Steps
- Learn about deployment strategies
- Explore the CLI reference
- Check out React Native integration
🎉 Congratulations!
You've successfully set up CodePush for your React Native app. Your users will now receive updates automatically without needing to download a new version from the app store.