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

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!

Related

Android only version code is updating .application not updating

I pushed the app update on 28 June. But still some of our users are getting the old apk of app but the version code is latest on app info. and they cannot see the update button on play store.
I contacted support regarding this and they said that i should clear the cache of paly store.
Well i cannot go to every user and say them to clear cache of play store in order to get the latest update.

React native automatic update from store

Hi guys I need my react native app to update it self automatically (with user consent) when new version is published to the store (both android and ios)
I need the app to download the apk or ipa and complete the update process, not using CODE PUSH or OTA,
is it possible?
The app itself can't do that.
The closest thing you can do is:
Verify app version against the version on the server (if you have a back end).
Present a button to the user which will open the app store off your platform directly at your app's page, using deep linking.
You will have to keep server and deployed app versions in sync.

modifying a bundled react native app using expo

I have created a react native using app and created an apk for that using expo. Now I have to make some modification in that app. So do I need to build that again using build:android? or Is there any method to modify content in bundled app
If you have the over-the-air updates that expo offers enabled (I believe it's enabled by default), then whenever you publish your app (expo publish), the app on your phone will update automatically (you don't need to download the new apk). That also works when the app is on Play Store.
The way this works, is basically the app requests an updated js file from a public url on launch and runs that js instead of the old one. I personally dislike this approach so I disabled OTA updates for my app. In case you do too, then, you either need to manually listen for updates in your app (please refer to the above link) or install the new apk every time you build a new version (this is only useful in development).

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

When you publish a React Native app with Expo will over-the-air updates go out to previous versions on the App and Play Store?

I'm using Expo.io for publishing my over-the-air updates. I have submitted several new official updates (so new SDK/IPA files) to the App and Play store. I'm still using the same version of Expo as before. Will my over the air updates go out to the previous versions(people haven't gotten the offical app/play store update)? Or are the old versions stuck until the user manually updates to the latest version so that they can get OTA updates again?
If you upload a new build to the app store and play store, the user will need to download the build in order to get OTA updates for that build.
If you just build and push to the expo server, the user will be able to get OTA updates without any download.
The standalone app knows to look for updates at your app's published url.
From the documentation : Publishing Guide
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.
Core expo team member #ide answered your question in this comment:
The way Expo, the publishing system, and versions work is this:
The Expo client and standalone apps support multiple SDK versions (ex: 18, 17, 16, 15).
When you publish your project, the Expo server saves your project bundle and the "sdkVersion" value in exp.json or app.json.
When the Expo client loads your project, the server sends back the latest bundle with the greatest SDK version that your client supports. So if your client supports SDKs 15 through 18 and you've published your project with SDK 15 and SDK 16, the server will send back the latest bundle for SDK 16.
So if you had published your project with SDK 16 before but then went back to SDK 15, any client that supports SDK 16 would still receive the old SDK 16 bundle.
The old Play Store versions will still get OTA (exp publish) updates as long as the published URL hasn't changed, which you can set in your app.json. This is because that URL is hardcoded into the native code (it's in MainActivity.java for Android).
Your published URL will be expo.io/#your-username/slug. From app.json's documentation:
slug
Required. The friendly url name for publishing. eg: expo.io/#your-username/slug.