Quick Start
Your first CodePush over-the-air update for React Native in about ten minutes: set up, install the SDK, release with the CLI and watch it install.
This walks through one Android release end to end. iOS is the same with the iOS deployment and an Xcode Release build.
- Set up CodePush — sidebar → CodePush → Android → Set up CodePush. Copy the deployment key.
- Set up your project — keys, MainApplication / AppDelegate and
CodePush.sync()on launch (Project Setup). Build a release build and install it on a phone:npx react-native run-android --mode release. - Note the app version on that build —
versionNameinandroid/app/build.gradle(iOS: Xcode → target → General → Version). Releases only reach phones whose version matches-t. - Create a CLI access key — your avatar at the top right → CLI access keys → Create key (details).
- Install the CLI and log in (@codeonair/code-push-cli on npm):Terminal
npm install -g @codeonair/code-push-cli@beta codeonair-codepush login --serverUrl https://app.codeonair.com
- Change some JavaScript — a text on the home screen is easiest to spot — and release it:Terminal
codeonair-codepush release-react shop-android --targetBinaryVersion 1.0.0
- Open the app twice (release build): the first launch downloads the update, the next one runs it.
- Watch it in the dashboard — CodePush → Android lists every release with its installs; click one for downloads, installs and devices. Next time, try a small share first with
--rollout 20.
Mandatory vs optional updates#
Updates are optional by default and run on the next restart. Add --mandatory for fixes that can't wait — they install and restart right away. A device that skipped a mandatory release gets the next one as mandatory too.
Terminal
codeonair-codepush release-react shop-ios -t 1.0.0 --mandatory -d "Fix checkout"
Rollback & versioning#
Terminal
codeonair-codepush rollback shop-ios codeonair-codepush history shop-ios
A rollback adds a new release with the previous bundle, so devices move back on their next check. Releases are labelled v1, v2, …
Note
After a release, devices pick it up on their next update check — usually the next app start.