How do OTA updates work?

#1

I have a few questions about Expo OTA updates for standalone apps: it’s my understanding that iOS apps will download/install updates synchronously during cold starts and that Android will load them asynchronously during cold starts.

  1. If an app has been running in the background (possibly for several weeks) does it ever look for an available OTA update? Or does the user have to force close the app and restart it to get an update?
  2. It seems strange to me that iOS and Android behave differently. Is there a way to force the same behavior for both devices? eg. can I force Android apps to download OTA update synchronously?
  3. If Android downloads updates asynchronously, when is the update actually applied? Does the user need to force close the app to get the update? Or is it just there the next time the app is restored from the background?
#2
  1. Your users will need to force quit to get the updates.
  2. I don’t think so, but if you can help us do research that would be huge.
  3. If the app is restored from the background, a user will need to terminate the app and reboot it to get the updates.

When you build the binary, the current version of your app JavaScript is bundled so that it loads immediately the first time the app opens. But you’re not stuck with that version of your code, you can publish updates at any time after that without needing to re-build the binary. For example, if you find a bug or want to add some functionality to the app after submitting the binary.

The standalone app knows to look for updates at your app’s published url, and if you publish an update then the next time a user opens your app they will automatically download the new version. These are commonly referred to as “Over the Air” (OTA) updates, the functionality is similar to CodePush, but it is built into Expo so you don’t need to install anything.

Updates are handled differently on iOS and Android. On Android, updates are downloaded in the background. This means that the first time a user opens your app after an update they will get the old version while the new version is downloaded in the background. The second time they open the app they’ll get the new version. On iOS, updates are downloaded synchronously, so users will get the new version the first time they open your app after an update.

Source: https://docs.expo.io/versions/latest/guides/publishing.html#deploying-to-the-app-store-and-play-store

#3

hi @jimmylee , does the “auto update” from android store work? Like if we upload a new apk ? Do we have to configure something to make that work ?

thanks

#4

Yes, Google’s Play auto-update will also work (if the Android user has that feature enabled), so if you publish a new APK to Google Play, your users will automatically get it. You don’t need to configure anything with Google to get that feature; it’s an option that users can turn on and off (with modern Android devices I believe the default setting is “on”).

#5

Will Expo.Util.addNewVersionListenerExperimental be supported in iOS too at some stage?

I’ve been having a bad experience with iOS sync loading lately, when I’m on a flaky network connection it takes a good while to load the app :(. When in airplane mode (offline) it loads the app fine.
I guess there’s a timeout somewhere but it’s probably too long.

Ideally the mechanism for updates will be the same on both platforms. Is there any reason why they’re different or it’s just the way it was implemented at the time and it stayed like that?

Checking for updates on the background would be a great plus not to prevent the user from accessing the app at any time.

#6

@ide thanks that’s good news.
now it’s strange in testflight it’s not taking the latest version of published app

2 Likes
#7

@jimmylee can we disable OTA updates???

#8

I’m facing the same problem. Built standalone app with Expo, uploaded to Testflight but it’s not getting new exp published versions.

Have u figured out why?

cc @ide

#9

@philip_mvpfastlane i was on the wrong expo account :slight_smile: it was taking the updates after switching

1 Like
#10

Yes. See the docs: https://docs.expo.io/versions/latest/guides/configuration.html#updatesconfiguration-for-how-and-when-the-app-should-request-ota-javascript-updatesenabledif-set-to-false-your-standalone-app-will-never-download-any-code-and-will-only-use-code-bundled-locally-on-the-device-in-that-case-all-updates-to-your-app-must-be-submitted-through-apple-review-defaults-to-true-note-that-this-will-not-work-out-of-the-box-with-expokit-projectscheckautomaticallyby-default-expo-will-check-for-updates-every-time-the-app-is-loaded-set-this-to-on_error_recovery-to-disable-automatic-checking-unless-recovering-from-an-error-must-be-one-of-on_load-or-on_error_recoveryfallbacktocachetimeouthow-long-in-ms-to-allow-for-fetching-ota-updates-before-falling-back-to-a-cached-version-of-the-app-defaults-to-30000-30-sec-must-be-between-0-and-300000-5-minutes.

#11

I also wanted to ask a question since it’s related to this thread, if I deploy a newer version to the app/play store and my published version is older, will the currently install app revert back to the published version?

I’m assuming it does not but I am just confirming.

Thanks.

#12

Can someone from Expo clarify the Apple policy on allowing OTA updates. It was my understanding prior that Apple did not allow remote updates of apps because it circumvented their review process. Understandably a WebView app could do the same. As far as I can tell on production for sale iOS apps, OTA is working.

3 Likes