SudoPlz / sp-react-native-in-app-updates

An in-app updater for the native version of your react-native app.
MIT License
459 stars 65 forks source link

Android: Error: sp-react-native-in-app-updates checkNeedsUpdate error: Error: com.google.android.play.core.install.InstallException #185

Open serhii-yalla opened 1 month ago

serhii-yalla commented 1 month ago

[Error: sp-react-native-in-app-updates checkNeedsUpdate error: Error: com.google.android.play.core.install.InstallException: -6: Install Error(-6): The download/install is not allowed, due to the current device state (e.g. low battery, low disk space, ...). (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_INSTALL_NOT_ALLOWED)]

serhii-yalla commented 1 month ago

Here is part of code where it happens

useEffect(() => {
    const timeout = setTimeout(async () => {
      const navigate = (result?: NeedsUpdateResponse) => {
        appLocalStorage.baseUrl.get().then((baseUrl) => {
          appLocalStorage.authToken.get().then((authToken) => {
            appLocalStorage.deviceID.get().then(async (deviceID) => {
              if (result?.shouldUpdate) {
                navigation.reset({
                  // @ts-ignore
                  index: 0,
                  routes: [{ name: AUTH_NAVIGATION_SCREENS.NEW_VERSION }]
                });
              } else if (baseUrl === null || authToken === null || deviceID === null) {
                navigation.reset({
                  // @ts-ignore
                  index: 0,
                  routes: [{ name: AUTH_NAVIGATION_SCREENS.AUTHENTICATION }]
                });
              } else {
                navigation.reset({
                  // @ts-ignore
                  index: 0,
                  routes: [{ name: AUTH_NAVIGATION_SCREENS.LOGIN }]
                });
              }
            });
          });
        });
      };

      try {
        const result = await inAppUpdates.checkNeedsUpdate();
        navigate(result);
      } catch (error) {
        console.log(error);
        Sentry.captureMessage("ERROR. sp-react-native-in-app-updates", {
          extra: {
            error
          }
        });
        navigate();
      }
    }, SPLASH_SCREEN_MS_LATENCY);

    return () => clearTimeout(timeout);
  }, [navigation]);
serhii-yalla commented 1 month ago

Suppose that happens only on emulator devices

lutfi-haslab commented 3 weeks ago

Duplication Issue: https://github.com/SudoPlz/sp-react-native-in-app-updates/issues/41 I have the same problem as you. My solution was to upload a lower version (0.5.2 in my case) to Internal Testing, then install version 0.5.2. Make a release for the newer version 0.5.3, and upload it again to Internal Testing. Now open the app; the update modal should be showing.

You can't install release app directly to your device.

Screenshot 2024-08-21 at 16 36 12