CodePush is a cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices. It works by acting as a central repository that developers can publish certain updates to (e.g. JS, HTML, CSS and image changes), and that apps can query for updates from (using our provided client SDKs). This allows you to have a more deterministic and direct engagement model with your end-users, while addressing bugs and/or adding small features that don’t require you to re-build a binary and/or re-distribute it through any public app stores.
1. Install the CodePush CLI
You manage your CodePush account using our NodeJS-based CLI. To install it, open a command prompt or terminal, and type npm install -g code-push-cli
Note: On OSX and Linux, you may need to prefix this command with sudo
2. Create a CodePush account
Before you can release any updates, you first need to create a CodePush account. To do this, simply type the following command via the CLI and authenticate with either your GitHub or Microsoft account: code-push register
3. Register your app with the service
In order to let the service know about your app, simply register it using a recognizable name. Create an app for each OS you target:
code-push app add MyApp-iOS ios react-native
code-push app add MyApp-Android android react-native
4. CodePush-ify your app
Add the appropriate CodePush client SDKs to your app, and configure them to query for updates against the app deployment created above. The following provide details on how to do this for each unique app type:
5. Release an app update
After making changes to your app’s code or assets, push the update to your staging environment by using the CLI command which corresponds to the app type you are building (React Native or Cordova), and specifies the name of your CodePush app and the platform that your update is targetting (iOS or Android).
React Native
Run the release-react
command in the CodePush CLI, which will handle bundling your JavaScript and asset files and releasing the update to the CodePush server.
For example: code-push release-react MyApp-iOS ios
Cordova
Run the release-cordova
command in the CodePush CLI, which will handle bundling your JavaScript and asset files and releasing the update to the CodePush server.
For example: code-push release-cordova MyApp-Android android
6. Run your app
And that’s it! All users running your app will receive the update using the experience you configured in step #4. For more details, refer to the CLI and client SDK documentation (Cordova, React Native).