EXPO OTA requires killing of app twice to reflect new updates

As per documentation

By 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_RECOVERY

I am not clear here by the words “Expo will check for updates every time the app is loaded” because the app checks for updates only when I kill the app and open again.

Also if I close the app and kill it again then only new changes are reflected.

So for me to see the latest published updates, I need to kill the app & open it twice to see the latest updates in-app.

Is this expected behavior?
If I want to download the update at first open which out killing the app, is this something possible?

By default, Expo will try to download a new update with a timeout of 0, which means that it will not wait to download the update, but will instead open the existing version of the app right away. Meanwhile, it downloads the update in the background. A single restart after that should be sufficient to load the updated version.

You can set a higher timeout if you want to update to be downloaded and installed before continuing to open the app. Depending on the user’s connection, this could lead to a delay opening the app. The setting you’d be looking for is fallbackToCacheTimeout: app.json / app.config.js - Expo Documentation.

Hi @dhameliya.work

In addition to what Kim says, if you want more control you can implement pretty much whatever you want. e.g. I have an app where every time the user clicks on one of the buttons it checks if enough time has passed since the last “check for updates”. If so, it calls Updates.checkForUpdateAsync() . If an update is available it pops up a floating action button to prompt the user to download it using Updates.fetchUpdateAsync() and then reloads the app using Updates.reloadAsync() .

I have seen someone on the forums mention that they do update checks when the app is brought to the foreground, which they detect using AppState.

Another post on the forums said they send the app version in all of their API calls and if the server gets a request from an old version of the app it returns a response that causes the app to download an update and reload.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.