Hi everyone, I’m kind of lost with the strategies to update my app !
imagine a user on the version 1.5 of my app
then I make a new build (pushed to the appStore) version 2.0
then I make an OTA update version 2.1
how should I handle the updates in the client side for him?
first prompt the user to update through the app store ? (or is it naturally done ?)
then wait for version 2.1 to be installed (forced or not) through OTA ?
It is not natural done for the user. I can’t remember the specfic rules, but I’m almost certain that for both android and ios stores the user can disable automatic updates. We need to force our users to update. We do two things:
App/Play store releases - features
We have made a nano/micro service, that our app can ask for the newest version. If the apps version is lower than the version received from the store we show a dialog with a link to the play/app store
OTA - We only use this for hotfixes
Control when the app should update, so in app.config
Heres is some of our code, not a complete example:
// in an app is on foreground hook
const [isCheckingForUpdate, setIsCheckingForUpdate] = useState(false);
const [showReloadDialog, setShowReloadDialog] = useState(false);
const checkForUpdates = async () => {
if (!isCheckingForUpdate) {
try {
setIsCheckingForUpdate(true);
// This require you to always publish when your expo version changes
// If there is no manifest it will fail
const update = await checkForUpdateAsync();
if (update.isAvailable) {
const result = await fetchUpdateAsync();
result && result.isNew && setShowReloadDialog(true);
}
} catch (error) {
log.warn('Could not handle OTA updates', error);
} finally {
setIsCheckingForUpdate(false);
}
}
};
checkForUpdates();
};
// somewhere in a dialog when the user presses ok:
reloadAsync();