Installing OTA update React Native app

Gaurav Kumar
2 min readMar 28, 2023

--

Source: Google Image

To install an Over-The-Air (OTA) update module in a React Native app, you can use Expo or CodePush. Both of these tools allow you to deploy updates to your app without having to submit a new build to the app stores.

This guide will focus on Expo, which is a popular choice for React Native developers. Expo provides a managed workflow that simplifies the app development process, including support for OTA updates.

Install Expo CLI:

npm install -g expo-cli

Create a new React Native project using Expo:

expo init MyOTAApp

Choose a template and follow the prompts to set up your new app. Once it’s created, navigate to the project folder:

cd MyOTAApp

Start your app:

expo start

You should now have a running React Native app with Expo’s managed workflow.

Configuring OTA updates:

Expo provides OTA updates out of the box. To configure the update behavior, open app.json and add an updates object inside the expo object:

{
"expo": {
...
"updates": {
"enabled": true,
"fallbackToCacheTimeout": 0,
"checkAutomatically": "ON_APP_LOAD"
},
...
}
}

These settings ensure that:

  • OTA updates are enabled ("enabled": true).
  • The app tries to fetch new updates and falls back to the cached version immediately if an update isn’t available or takes too long to download ("fallbackToCacheTimeout": 0).
  • The app checks for updates automatically each time it’s loaded ("checkAutomatically": "ON_APP_LOAD").

Publish your app:

expo publish

This will create a new release of your app, including the OTA update.

Test OTA updates:

Make a change in your app, such as modifying the text on the main screen. Then, run expo publish again. Open the app on your device or simulator, and you should see the update automatically applied.

Keep in mind that some changes, such as those involving native modules or app permissions, still require you to build and submit a new version of your app to the app stores. However, for JavaScript and asset updates, OTA updates with Expo can save you time and streamline your development process.

--

--