Check for and fetch new js version
complete
Matt Osborn
It currently takes 2 restarts to update js code on Android after a publish. See:
If there was a method to check for and fetch a new version it would enable better UX patterns - auto and manual update checking and fetching followed by a single restart to load the new version.
Michael Wood
complete
Michael Wood
I can't say off hand when this was implemented, but there is a way to check for and download an update and then restart or prompt the user to restart. I have used it myself.
I implemented this a couple of SDKs ago, so I'm not sure if any of the details have changed with the newer update code in SDK 37/38, but basically I call
Updates.checkForUpdateAsync()
every now and then. If an update is available I call Updates.fetchUpdateAsync()
. If everything went OK I set updateAvailable
to true
which causes an "Update" button to show. When the user click on the button I call Updates.reloadFromCache()
to reload the app.Based on the bug mentioned in Matt Osborn's post it looks like this functionality was implemented in SDK 26. The bug is also closed, so it seems this feature request should be closed too.