Client app doesn't use latest published code

We have signed up for the Teams feature of expo so that we can use the expo client app to share out app with multiple users in its early development stages.

We’ve published the app and our users were able to open it up successfully in the client app.

We have now published an update, but when our users open the app via the expo client app, they do not receive the latest published file. The only way that they can get the latest is by deleting the expo app, then re-downloading it again.

How can I use the expo client app to share the latest version of my app to my users?

There is now an active issue open to discuss this:

As a workaround I have made a component which checks for updates every minute and flashes a message to the user if a new update is available:

import React, { useEffect, useState } from 'react';
import { Text, TouchableOpacity } from 'react-native';
import { Updates } from 'expo';
import Constants from 'expo-constants';

export default function UpdatesAvailable() {
  if (__DEV__) {
    return null;
  }
  
  const [updateAvailable, setUpdateAvailable] = useState(false);

  useEffect(function () {
    const intervalId = setInterval(async () => {
      try {
        const update = await Updates.checkForUpdateAsync();
        if (update.isAvailable) {
          await Updates.fetchUpdateAsync();
          setUpdateAvailable(true);
        }
      }
      catch (e) {
        console.log(e)
        setUpdateAvailable(false);
      }
    }, 60000);


    return () => {
      clearInterval(intervalId);
    }
  }, []);

  return (
    <React.Fragment>
      {updateAvailable &&
      <TouchableOpacity
        style={{
          zIndex: 99999,
          margin: 0,
          marginTop: Constants.statusBarHeight,
        }}
        onPress={async () => {
          Updates.reloadFromCache();
          setUpdateAvailable(false);
        }}
      >
        <Text style={{
          textAlign: 'center',
          width: '100%',
          backgroundColor: '#00e4ff',
          padding: 20
        }}>
          New app version is available. Click here to update.
        </Text>
      </TouchableOpacity>
      }
    </React.Fragment>
  );
}

Hi

I wanted to do something similar, but I only wanted to check for updates every 6 hours or so. Apparently setInterval() is not a good idea for something like that. The app is very simple and I decided the best workaround was to trigger a check to see if enough time has passed every time the user clicks on one of the buttons. If so, do a check for updates and display an “Update” button if so.

In case anyone is interested in my code and especially if they have suggestions for improvements, I posted a comment about it here:

Here’s the code.