Ship OTA (Over-The-Air) When in an Emergency

Mike Grabowski
Jakub Mazurek

blog content

Need help with Performance Optimization? 
hire us
Need help with Super app development
hire us
Need help with React Native?
hire us
Need help with migration to React Native?
hire us
Our React Native EU Conference is back
register nowlearn more

The following article is part of The Ultimate Guide to React Native Optimization.

Why should you submit critical updates and fixes instantly through OTA?

Issue: Traditional ways of updating apps are too slow and you lose your precious time on them.

The traditional model of sending the updates on mobile is fundamentally different from the one we know from writing JavaScript applications for other platforms. Unlike the web, mobile deployment is much more complex and comes with better security out-of-the-box. We have talked about that in detail in the previous section focused on the CI/CD.

What does it mean for your business?

Every update, no matter how quickly shipped by your developers, is usually going to wait some time while the App Store and Play Store teams review your product against their policies and best practices.

This process is particularly challenging in all Apple platforms, where apps are often taken down or rejected, because of not following certain policies or meeting the required standard for the user interface. Thankfully, the risk of your app being rejected with React Native is reduced to minimum as you’re working on the JavaScript part of the application. The React Native Core Team ensures that all the changes done to the framework have no impact on the success of your application’s submission.

As a result, the submission process takes a while. And if you’re about to ship a critical update, every minute counts.

Fortunately, with React Native, it is possible to dynamically ship your JavaScript changes directly to your users, skipping the App Store review process. This technique is often referred to as over the air update. It lets you change the appearance of your application immediately, for all the users, following the technique that you have selected.

When critical bugs happen - minutes and hours can be essential. Don’t wait for Apple and Google to review your app.

If your application is not OTA-ready, you risk it being left with a critical bug on many devices, for as long as Apple / Google review your product and allows it to be distributed.

Even though the review times got much better over the course of years, it is still a good escape hatch to be able to immediately recover from an error that slipped through the testing pipeline and got into production.

Solution: Implement OTA updates with App Center / CodePush

As mentioned earlier, React Native is OTA ready. It means that its architecture and design choices make such updates possible. However, it doesn’t ship with the infrastructure to perform such operations. To do so, you will need to integrate a 3rd party service that carries its own infrastructure for doing so.

The most popular and widely used tool for OTA updates is CodePush, a service that is now a part of Microsoft’s App Center suite.

<p-bg-col>Note: You have to create an account in the App Center in order to continue. The OTA option will be visible under the application you have created. It is generally a good practice to use both OTA and release capabilities from App Center for easier configuration.<p-bg-col>

Configuring the native side

To integrate CodePush to your application, please follow the required steps for iOS and Android respectively. We decided to link to the official guides instead of including the steps here as they include additional native code to apply and that is very likely to change in the coming months.

Configuring the JavaScript side

Once you set up the service on native side, you can use the JavaScript API to enable the updates and define when they should happen. The simplest way that enables fetching updates on the app startup is to use the "codePush" wrapper and wrap your main component.

That’s it! If you have performed all the changes on the native side, your application is now OTA ready. For more advanced use cases, you can also change the default settings on when to check for updates and when to download and apply them. For example, you can force CodePush to check for updates every time the app is brought back to the foreground and install updates on the next resume.

The following diagram code snippet demonstrates such a solution:

Custom CodePush setup

Shipping updates to the application

After configuring the CodePush on both JavaScript and the native side of React Native, it is time to launch the update and let your new customers enjoy it. To do so, we can do this from the command line by using the App Center CLI.

Then we continue with a release command to bundle React Native assets and files and send them to the cloud:

Once these steps are complete, all users running your app will receive the update using the experience you configured in the previous section.

<p-bg-col>Note: Before publishing a new CodePush release, you will have to create an application in the App Center dashboard. That will give you the ownerName and appName that you’re looking for. As said before, you can either do this via UI by visiting App Center or by using the App Center CLI.<p-bg-col>

Benefits: Ship critical fixes and some content instantly to the users

With OTA updates integrated to your application, you can send your JavaScript updates to all your users in a matter of minutes. This possibility may be crucial for fixing significant bugs or sending instant patches.

For example, it may happen that your backend will stop working and will cause a crash at the startup. It may be a mishandled error - you never had a backend failure during the development and forgot to handle such edge cases. A potential fix for this issue is simple - it may be enough to just display a fallback message and inform users about the problem. While the development will take you around one hour, the actual update and review process can take hours if not days.

With OTA updates set up, you can react to this in minutes without risking that bad UX will affect the majority of users.

Mike Grabowski
Co-founder & CTO of Callstack. Mike is a React Native core contributor and author of many libraries. When he isn't working, he is on a race track.
arrow icon
MORE posts from this author
Jakub Mazurek
arrow icon
MORE posts from this author

Bundle React Native apps using Webpack features

Discover Re.Pack – a Webpack-based toolkit that allows you to build a React Native app with the full support of the Webpack ecosystem.

learn more

More posts from this category

Ensure your React components perform as intended as your app grows

Discover Reassure - our open-source library that allows you to run performance tests measuring the average rendering time of the in-app components.

business benefits

Performance Optimization

To stay competitive, you need a high-performing app. Improving React Native performance can bring your company many business and tech benefits. To learn more about it, check the page entirely dedicated to React Native Performance Optimization. Discover a real-life example of React Native optimization we performed for Aaqua, a Singaporean platform that enables global users to share their passion through groups.

Bundle React Native apps using Webpack features

Discover Re.Pack – a Webpack-based toolkit that allows you to build a React Native app with the full support of the Webpack ecosystem.

business benefits

Why React Native?

Building an all-in-one platform can bring your company a lot of business and tech benefits like seamless UX experience, global reach, brand growth just to name a few. To learn more about the benefits of using React Native to develop super apps, check out the MoMo case study. Where we helped improve app's performance by migrating architecture to Re.Pack.

stay tuned

Subscribe to our newsletter

You may unsubscribe from these communications at any time. For details see the Privacy Policy.