Wednesday, October 18, 2023
Expo OTA Updates Not Working? Here's How expo-ota-manager Can Save You Time and Hassle with OTA Updates
Have you ever wished you could update your mobile app without the hassle of submitting it to the App Store or Google Play Store? If so, you might want to check out Expo. Expo has a feature that allows you to deliver Over-The-Air (OTA) Updates to your mobile app. You can use this feature to quickly fix bugs or add new features to your app without waiting for the App Store review process.
However, using the default behaviour may not always be the best option for a project. Expo provides the expo-updates package, which allows you to control how and when your app checks for updates. But this requires some extra work.
That's where the expo-ota-manager comes to the rescue. It is a simple package that allows you to easily manage the Over-The-Air (OTA) updates of your app without having to worry about the details of the expo-updates package.
How Expo updates work
To understand how expo-ota-manager works, let's first review how Expo updates work by default. When an Expo app starts, it checks for any new versions available on the Expo server. If there is a new version, it will download it and store it on the device. Then, the next time the app starts, it will load the latest version.
This sounds simple and convenient, but it has some drawbacks. For example, if you have a bug in your app and release a new version to fix it, the user will have to close and open the app twice to get the fix. This is because the app will download the new version in the background but will only load it the next time it starts. This can be frustrating for the user, especially if the bug is critical or affects the user experience.
How expo-ota-manager works
expo-ota-manager is a helper package that allows you to easily configure how and when your app checks for updates, downloads them, and prompts the user to restart the app.
Some of the features that expo-ota-manager offers are:
- Customisable dialogue options, such as message, title, and button texts
- Ability to set a reminder interval for the user to update the app (in hours)
- Ability to check for updates while the app is running, not only when it launches
Installation and usage
To install it in an Expo project, you first need to install its peer dependencies:
And then you can add it in the project dependencies:
Then you can enable it in your root App component:
You can customise the dialogue options by passing an object as a prop to the initialiseOtaManager hook. Some properties you can define are buttons, text, messages, re-prompt intervals, and more.
For a complete list of available props, please see the package documentation.
How to test expo-ota-manager with an example app
If you want to see how expo-ota-manager works in action, you can clone the expo-ota-manager-example repository and run it on your device. This is a sample Expo app that uses expo-ota-manager to handle OTA updates. You can follow the installation instructions and the testing guide on the repository to set up and use the example app.
I hope you enjoy using expo-ota-manager for your Expo projects.
Happy coding! 😊
Enjoyed this tutorial? Sign up to our monthly newsletter and make sure to check out our other dev blogs!