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? - react-native

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.

Related

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.

How to deploy codespush bundle on old targets when there are native changes on the new build

Before i continue, let me let you know that i know the code to deply to a targeted build for codepush
appcenter codepush release-react -a aountName/appName -d Production -m --description "CommentHere" -t versionName
I have tried to figure this out on my own and i have not been able to.
I have several versions of my app which i have deploy using CodePush and everything works well but I started having fears of crashes when i installed new packages on the latest build.
This implies the current code base would have new native differences as compaird to the old version.
The question is how can i deploy my new build with new native codes
and packages present to an old version of my app which does not have those
native packages without running into several crashes from all the users using the old version of the app...
I ask this cos i have a feeling if i push the new build with the new changes in UI and native chnages to the old version of my app, the app old app would crash.
If a bug comes in for an old version, how do I fix it and deploy it
for the old version only? Bugs may be critical and not everyone will
have the latest version of the app Or, the bug may only exist on a old
version of the app.
I await your response.
Code push will not affect any native code written within the Android or the iOS projects of a React-Native application. If you read the documentations carefully, it specifically says that it does not change / modify / update the native portion of the app.
Why?
This is because of the way the CodePush mechanism works. In essence, CodePush only stores and triggers the update of the JS bundle of the React-Native application.
This is why we wrap only the JS main app instance with CodePush HOC (Higher Order Component). This is what's happening when you do:
CodePush(MyApp); //wrapping the js bundle at app-root
So, unfortunately in your case, if there are native codes involved, regardless of deployment to a new or old version of the app, it has to be a AppStore / Playstore driven deployment.

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 code update

I published my first app to AppStore last night.
I just want to know if there is code change in my app,
Should I have to re-build and upload .ipa file to itunes connect again?
(Currently, I do not use CodePush and I build app with exp)
Thanks.
Expo comes with a built in CodePush equivalent.
Whenever you publish to expo (using exp publish, the XDE etc), expo builds new JS bundles and uploads them to their servers.
Users who downloaded the app from the stores will get those updates - while iOS users will get them as soon as they open the app, Android users will get them in the second time (iOS is does this syncly while Android asyncly).
Note that this does not apply to changes in the app config (app.json), including sdk upgrades or any other configuration changes.
Yes, you will need to rebuild the release version of your app and upload to the App Store as a new version.