My published Expo App on Google Play still installs an old version - react-native

I uploaded a new version of my app developed with Expo to Google Play, but when users install it, it starts with the old version first and updates afterwards, while users are running it.How can I make it install the latest version? I need to mention that a deleted the previous apk in Google Play console, and it remains only one, the latest. Thank you.

Related

How to Get the specific APP_Version_Name or App_Version_Code that is currently installed in user's mobile In REACT-NATIVE

I updated the App in playstore and i get the updated app version code, but Now I want to fetch the current version code that the user has installed. So then i match both the version codes, on that behalf i alert the user to update new version of that app. So how to find the current version of App the is installed in mobile?
You can use https://github.com/react-native-device-info/react-native-device-info#getversion.
you need to get the installed version from react-native-device-info#getversion and compare it with the version on your DB.

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 Expo Built App Doesn't Get the Latest Javascript

Ok, I have a problem with expo build. Please let me know if you need more details. Basically, the project I am working on is NOT detached. It is just using Expo.
So I publish it. Let's say the javascript bundle version is 0.17, and I am publishing a breaking change to 0.18.
When I load the app from Hockey App, the javascript bundle is clearly not 0.18 because I don't see my breaking changes. Then, I close the app and re-open it, and the JS bundle is updated.
The build script is:
exp build:android
[exp] Android:
[exp] APK: [AWS LINK] apk has been generated, it took 0 seconds
Then, I get an AWS link to the APK, which I download and upload to Hockey Apps.
How should I diagnose this problem?
Exp version is 44.0.0
It is the way it works in Android. First time you open your app after you publish, the code is downloaded in background. Next time it will run the new code.
Quoting the documentation:
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.

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.