0

I have a problem with code push, i'm running with the following code.

import 'moment/locale/pl';
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';
import App from './src/App';
import moment from 'moment';
import codePush from 'react-native-code-push';

import {onDisplayNotification} from './src/utils/showNotification';

let codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_SUSPEND,
  minimumBackgroundDuration: 30 * 60,
  mandatoryInstallMode: codePush.InstallMode.IMMEDIATE,
  updateDialog: {
    title: 'Nowa aktualizacja!',
    optionalUpdateMessage:
      'Dostępna jest nowa aktualizacja, kliknij przycisk żeby ją zainstalować.',
    optionalIgnoreButtonLabel: 'Pomiń',
    optionalInstallButtonLabel: 'Zainstaluj',
    mandatoryUpdateMessage: 'Dostępna jest nowa wymagana aktualizacja.',
    mandatoryContinueButtonLabel: 'Zainstaluj',
  },
};

moment.locale('pl');

AppRegistry.registerComponent(appName, () => codePush(codePushOptions)(App));

The app check for updates on app start, but only on app start. The problem is when the user closes the app when the modal is shown, then open it and code push modal is not showing and I only see '[CodePush] Sync already in progress.' in the console. How to kill that sync? Or recall it? With checkFreuency manul it works same. The code push modal is shown only when I force stop the app in Android app manager and then open it.

I've tried use codepush.sync on every appState change (foreground/background) but I have the same issue

rd51
  • 252
  • 4
  • 11
illgresi
  • 11
  • 2
  • Okay i found a partial solution for this in [api-docs](https://github.com/microsoft/react-native-code-push/blob/master/docs/api-js.md#codepushrestartapp), when "Sync in progress" we can force restart app with codePush.restartApp() – illgresi May 15 '23 at 13:16

0 Answers0