Updated December 4, 2019
Strengths and Limitations of Over-the-Air Updates
This month at React Native School we're talking about over-the-air updates. It's one of the big benefits to using React Native to build your mobile apps.
In the class we'll be covering the actual implementation but today I just want to do a quick primer on over-the-air (OTA) updates so we're all on the same page.
What are Over-the-Air Updates?
Typically, when you want to release an update to a mobile app, you need to go to the app store.
That means assembling a new release, uploading it, and putting it through the review process.
This has gotten dramatically better in recent years, but it's still a bit of a process.
OTA updates allow us to send updated JavaScript, which doesn't have to be compiled, to our mobile app.
This JavaScript will then interact with the native components of our app to change the user experience.
This allows us to have an update experience much like the web where we publish something and the users have it. No waiting for it to compile, process, and then waiting for a user to download it.
Ship and you're done.
Great, right?! I think so. But it needs to be used cautiously. This functionality works in a bit of a grey area from Apple so we need to be careful.
When shouldn't they be used?
When people first learn about OTA updates they get really excited. Rightfully so! But, like I said above, you need to be cautious with it.
So, what should you not use OTA updates for?
- New features
- UI changes
- Changing the functionality of your app
- Anything that may impact native code
Let's touch on that last point first. Since OTA updates only apply to JavaScript code you can't add something that has a native code change (if anything changed in the ios/ or android/ directories than you've got native code changes). That's because the updated native code won't exist on the user's device and will most likely cause a crash.
The other ones are related to app store terms and expectations of a user. They expect updates to happen when they download an update from the app store. Maintain user expectations. Apple also wants to make sure that your app is following their guidelines and rules.
No bait and switch schemes are allowed.
When should they be used?
So now that I've ruined your dreams of OTA updates, what can OTA updates actually be used for? My rule of thumb (which is a conservative rule of thumb given the speed that I can release through the app store now) is:
- Beta features for a subset of trusted users
- Bug fixes
- Performance enhancements
I limit it to these categories because:
- Updates may happen when a user is on a cellular network. I don't want to eat up their data plan with huge updates
- They're updates that can happen in the background and, even though the code is updating, the user shouldn't really see any changes (though they may feel the performance improvements).
What tools should you use to do over the air updates?
So, how the heck do you actually do OTA updates?
There are two primary tools:
- If you're using Expo then you can use Expo's built in OTA update infrastructure. You can learn more about them in Expo's docs. In this month's class we won't be using Expo's infrastructure for the code we write but all the concepts will be the same.
- If you're using a "traditional" React Native app the top option is Microsoft's App Center CodePush. I've used this product for years and am constantly amazed by it.
I'm excited to show you all the tricks of the trade when it comes to OTA updates with React Native! If it sounds interesting, become a member to get access to the class when it's live!