microsoft / cordova-plugin-code-push

Cordova plugin for CodePush
http://appcenter.ms
Other
644 stars 336 forks source link

InstallMode.ON_NEXT_RESTART restarted the apps after updates #614

Open mOOnIrsama opened 4 years ago

mOOnIrsama commented 4 years ago

Hi, im using InstallMode.ON_NEXT_RESTART, it shouldnt restart the app after updates. but its keep restarting the apps and all cordova plugin seems missing. after i kill the app and relaunch it shows my updates is rollbacked. please help

im using plain cordova not ionic, i've tried wkwebview-engine before. same issue

"cordova-plugin-code-push": "^1.12.2",
"cordova-plugin-ionic-webview": "4.2.1",
function syncCode() {
window.codePush.sync(
        function (syncStatus) {
            switch (syncStatus) {
                // Result (final) statuses
                case SyncStatus.UPDATE_INSTALLED:
                    navigator.splashscreen.hide();
                    window.codePush.notifyApplicationReady();
                    console.log("The update was installed successfully. For InstallMode.ON_NEXT_RESTART, the changes will be visible after application restart. ");
                    break;
                case SyncStatus.UP_TO_DATE:
                    navigator.splashscreen.hide();
                    console.log("The application is up to date.");
                    break;
                case SyncStatus.UPDATE_IGNORED:
                    navigator.splashscreen.hide();
                    console.log("The user decided not to install the optional update.");
                    break;
                case SyncStatus.ERROR:
                    navigator.splashscreen.hide();
                    console.log("An error occured while checking for updates");
                    break;

                // Intermediate (non final) statuses
                case SyncStatus.CHECKING_FOR_UPDATE:
                    navigator.splashscreen.show();
                    console.log("Checking for update.");
                    break;
                case SyncStatus.AWAITING_USER_ACTION:
                    console.log("Alerting user.");
                    break;
                case SyncStatus.DOWNLOADING_PACKAGE:
                    console.log("Downloading package.");
                    break;
                case SyncStatus.INSTALLING_UPDATE:
                    console.log("Installing update");
                    break;
            }
        },
        {
            installMode: InstallMode.ON_NEXT_RESTART, updateDialog: false
        },
        function (downloadProgress) {
            console.log("Downloading " + downloadProgress.receivedBytes + " of " + downloadProgress.totalBytes + " bytes.");
        });
}
ermik commented 4 years ago

Do you see rollback happening in the logs? Can you share your log output and your project's config.xml?

Krasavinigor commented 4 years ago

Hi @mOOnIrsama! Unfortunately, I couldn't reproduce this issue. Could you please provide a demo project? Also, check https://github.com/microsoft/cordova-plugin-code-push/issues/614#issuecomment-664474242

shekhar-shubhendu commented 4 years ago

It is happening with us too. But not always. I do not know how to repro though.