Forcing refresh of a published Expo app - react-native

could somebody explain how the Expo client decides whether to refresh my app or use the current version cached (~already downloaded) in the client?
When I'm pushing out a new version with exp push, the Expo app (on Android) doesn't seem to pick it up, unless I clear all data of the app.
I thought that bumping the expo.version in the app.json would solve this but this doesn't seem to be the case.
Thanks!
UPDATE
Ok, I understand it is supposed to happen automatically, but this doesn't seem so - I tried multiple devices which were not offline - I suppose there must be something obvious I'm missing...
https://docs.expo.io/versions/latest/guides/offline-support.html#load-js-updates-in-the-background

Check that you don't have this option on the app.json file:
"updates": {
"fallbackToCacheTimeout": 0
},
I had this option in there and it prevented the app from waiting for a new version to be downloaded.

(on Android) I succeeded by opening the app in Expo, I would see the cached version, then I force stopped the app intentionally, both the app and the expo client. This removes it from the list of open apps on the phone.
Relaunched the expo client, then tapped my demo app again, and it loaded the new version. Tested a few seconds after publishing.

Related

why expo publish updates app on app store?

I have ejected app published in app store. I downloaded my app from app store in a device. And when I 'expo publish' ,the new update was automatically shown in my device. I am so confused. I wonder that if the local network is doing the updates or is it supposed to work like that? or how we can avoid this behaviour?
Simply Add enabled: false into app.json solved my problem. expo version 43.0.0
"updates": {
"fallbackToCacheTimeout": 0,
"enabled": false
},
The Over-the-air updates (OTA) allows send updates easier and faster without publish a new update in the store. You can read more about OTA updates here Over-the-air updates from Expo are now even easier to use! if you want to send the update to the store, you have to upload the new version and wait until they approve the app.
Previously, release builds of apps with expo-updates would embed the
latest published update of your app in the binary. Now, release builds
of both iOS and Android apps will create and embed a new update from
the JavaScript source on disk at build-time. This new update will not
be published automatically and will exist only in the binary with
which it was bundled.
This means you no longer need to run expo publish before creating a
release build for the first time.
This change makes the build process more flexible and similar to most
typical React Native apps. We hope it will make getting started with
expo-updates even easier and faster.

React Native fetch() response is different after updating app

I am developing an application in React Native. I just installed the release apk in my phone and all the fetch() responses are same as expected one.
But then I did changes in code. I built the release apk again. I installed the application without uninstalling the old one. Now the fetch responses are totally different.
It works fine if I reinstall it.
I don't know what is wrong in that. Is there anything like clearing caches or something needed to update the app?

Do OTA updates in Expo get in motion on the first opening after brand new download from the stores?

I developed an app with React Native and distributed it with Expo. I published the final version into Google Play and Apple Store.
Some time later I discovered in Expo's docs on Publishing that expo publish allows you to create an OTA ("over the air") update that is built into Expo and updates the app automatically, according to this answer:
The standalone app knows to look for updates at your app's published url.
This I tested and worked very well.
However, now I see that people downloading the app from the stores (that is, either Google Play or Apple Store) apparently get the initial version of the app, not the updated one.
What is the exact workflow for the OTA updates? Do they go and "replace" the existing version in Google Play and Apple Store the first time they open it? Or do they need to open it over again to get the update?
And what exactly triggers the update of the app?
We've been having similar problems. I can see two things which might be causing this in your case:
Check in app.json if updates.fallbackToCacheTimeout is set. If it's set, that's how long expo will try to download the latest update before showing the last downloaded version (which will be the initial version after initial download).
If you have a large update, expo will try downloading the update for 30s before showing the last version of your app.
Check here for more info: https://docs.expo.io/versions/latest/guides/configuring-ota-updates/
OTA updates do not replace the version downloaded from the app store, they are stored first in the device's cache before being run on app start after download. Source https://docs.expo.io/versions/latest/sdk/updates/
Update downloads are automatically triggered on app start, then, depending on the settings it will either wait (as long as updates.fallbackToCacheTimeout allows) before showing the app, or show it immediately.
You can force the app to run the latest update (if you have one waiting) by just force quitting the app, then restarting.
Hope this helps!

Expo uses old code even though new code has been deployed

I have a react-native app that is using Expo.
In the beginning of the project I pushed some code to the default publishing channel that was never intended to be used in production.
Since then I have released dozens of versions to production and mostly all works as expected. (New installs gets the latest JS code)
However, a few users still gets old versions of the code, even though they literally just downloaded the app from App Store / Google Play.
This is extremely frustrating. How can I make sure that fresh downloads of the app will download the correct/latest version och my JS?
Note that this is not related to the app detecting new code that might be available for download. It is the fact that the wrong code is downloaded and used to begin with. Is there any way to remove all JS-code except the very last version that I published? I imagine that would solve my issue
Turns out, expo don’t always do this successfully. You need to rebuild the react native bundle before publishing.https://proandroiddev.com/bundling-react-native-during-android-release-builds-ec52c24e200d
This is what expo gives as a feature known as Over the Air updates (OTA). Whenever a new version is built with expo channel, it automatically updates even in the app store and play store. But there is a way to disable the updates. the expo documentation for disabling:
It is possible to entirely disable OTA JavaScript updates in a standalone app, by setting updates.enabled to false in app.json. This will ignore all code paths that fetch app bundles from Expo's servers. In this case, all updates to your app will need to be routed through the iOS App Store and/or Google Play Store.
This setting is ignored in the Expo client.
And I do recommend you to read the documents of OTA, which is a good feature when you get to know all of it.
The expo link is expo OTA

React-native watchman doesn't work anymore

Few days ago I noticed watchman stopped working.
Using a real android device with shake gesture I cannot Reload the app (a reload doesn't take the changes to the code). Live reload and hot reloading don't work either.
The only way I have to get the app take the changes is to kill the packager and relaunch it (often neither this method makes the app takes changes!).
There is a way I can solve? This issue It's pretty frustrating.
I'll answer to myself. After further research, this issue looks to be caused by this option in app.json
"packagerOpts": {
"nonPersistent": "--nonPersistent"
}
which I've added to be able to produce a release build using Expo (otherwise I get error "socket hang up").
It would be nice if some Expo developer would post some infos about this issue and what that option in app.json really does (the docs says nothing).