CodePush install modes: IMMEDIATE or ON_NEXT_RESTART?
When an over-the-air update arrives, should your React Native app restart right away or wait for the next launch? How each install mode feels to users, and the setup we recommend.
Use ON_NEXT_RESTART for most CodePush releases, so the update applies quietly the next time the app starts. Keep IMMEDIATE for mandatory fixes that can't wait, because it restarts the app as soon as the update has downloaded. If a restart in front of the user is a problem, ON_NEXT_RESUME or ON_NEXT_SUSPEND apply the update around the app going to the background.
An over-the-air update is only useful if it reaches users — but restarting an app while someone is in the middle of checkout is a quick way to lose them. CodePush lets you choose when a downloaded update is applied. Here is how to pick. (Still on App Center's react-native-code-push? The step-by-step migration guide moves you over first.)
The two modes you'll actually use
| Install mode | What the user sees | Use it for |
|---|---|---|
ON_NEXT_RESTART |
Nothing now. The update is applied the next time the app starts. | Most releases: copy, layout and small fixes. |
IMMEDIATE |
The app reloads as soon as the update is downloaded. | Urgent fixes: a crash, a broken payment flow, a security issue. |
There is also ON_NEXT_RESUME, which applies the update when the app comes back from the background. It is a middle ground, but users can be surprised by a reload when they switch back to the app, so we rarely recommend it.
Our recommended setup
Let each release decide. Optional releases wait for the next start; releases you mark as mandatory install right away. With the SDK, @codeonair/code-push-react-native from npm, that is one call:
import CodePush from "@codeonair/code-push-react-native";
CodePush.sync({
installMode: CodePush.InstallMode.ON_NEXT_RESTART, // normal releases
mandatoryInstallMode: CodePush.InstallMode.IMMEDIATE, // releases marked mandatory
});
Call it once when your app starts. You don't need to wrap your root component — CodePush.sync() also confirms that the running update started correctly, which is what makes automatic rollback work.
Then choose per release from the CLI (npm install -g @codeonair/code-push-cli@beta):
# a normal fix: users get it on their next launch
codeonair-codepush release-react shop-android -t 1.0
# an urgent fix: installs immediately
codeonair-codepush release-react shop-android -t 1.0 --mandatory
You can also flip a build to mandatory later from the dashboard, without releasing again.
Ship safely with staged rollouts
For anything bigger than a one-line fix, release to a slice of devices first:
codeonair-codepush release-react shop-ios -t 1.0 --rollout 20
Watch installs and rollbacks for that build in the dashboard, then raise the rollout to 100%.
What happens if an update crashes
The SDK keeps the previous bundle. If the new one crashes before CodePush.sync() confirms it, the next launch goes back to the previous bundle, the failure is reported in the dashboard, and that update is never offered to the device again. You can also roll back by hand at any time:
codeonair-codepush rollback shop-android
What CodePush can't change
Over-the-air updates cover your JavaScript bundle and its images and assets. New native modules, permissions or changes to native code still need a store release — and the stores allow JavaScript updates as long as they don't change the app's primary purpose.
Updating in the background: ON_NEXT_SUSPEND
The CodeOnAir CodePush SDK has a fourth mode. ON_NEXT_SUSPEND installs the update while the app is in the background, so the user comes back to the new version already running. minimumBackgroundDuration (in seconds) makes it wait until the app has been in the background at least that long, so a quick switch to another app doesn't trigger it.
It suits mandatory releases you don't want to show as a visible reload. To bring the user back to the screen they were on, the codePush() wrapper can restore React Navigation's state after the restart:
import codePush from "@codeonair/code-push-react-native";
import { NavigationContainer } from "@react-navigation/native";
function App() {
return (
<NavigationContainer
initialState={codePush.restoredScreenState}
onStateChange={codePush.trackScreenState}>
{/* … */}
</NavigationContainer>
);
}
export default codePush({
mandatoryInstallMode: codePush.InstallMode.ON_NEXT_SUSPEND,
minimumBackgroundDuration: 10,
restoreScreen: true,
})(App);
iOS gives a backgrounded app about 30 seconds and Android may freeze it sooner, so keep the wait short. If the restart can't happen in the background, the update still runs on the next cold start.
FAQ
What are the default install modes?
If you pass nothing, optional updates use ON_NEXT_RESTART and mandatory ones use IMMEDIATE. Either option can be set to any of the four modes.
Does IMMEDIATE interrupt the user?
Yes. The app restarts as soon as the update is downloaded. Keep it for mandatory fixes, or use ON_NEXT_SUSPEND to install them without a visible reload.
Can I make a release mandatory after it's out?
Yes. Flip it to mandatory in the dashboard, or with codeonair-codepush patch, without releasing again.
Do install modes apply in debug builds?
No. Updates only apply in release builds. In debug builds React Native loads JavaScript from Metro and CodePush stays out of the way.
In short: ON_NEXT_RESTART by default, IMMEDIATE (or ON_NEXT_SUSPEND) for mandatory releases, and a 20% rollout for anything risky.
Still comparing services? See CodePush alternatives in 2026. Upgrading React Native at the same time? Read react-native-code-push and the New Architecture.
Try it: create a free account — the Free plan includes 5,000 CodePush downloads a month. Setup takes about ten minutes with the CodePush quick start.