Search code examples
androidcordovaionic4code-push

Ionic Codepush Cordova not available after sync


i'm trying to implement Code-Push from AppCenter into my Ionic v4 App. (ref)

I'm stuck on the following Problem: I can update the App, but when i close the App after that and open again it is the old Version again and it says:

Updade ignored, because it was rollbacked

So somehow the update is rolled back after i close the App. After searching for this problem i found that i have to run

this.codePush.notifyApplicationReady()

on application start. I added this to my code, but it doesn't work either. If i run the Application on a Android Emulator and open the Logs, AFTER the Update it says:

cordova_not_available

So it makes sense that the notifyApplicationReady doesn't work, but why is cordova unavailable?

initializeApp() {
    this.platform.ready().then(() => {
        this.statusBar.styleDefault();

        this.codePush.notifyApplicationReady().then(value => {
            console.log(value);
        });

        this.codePush.sync({
            deploymentKey: 'MY_KEY',
            installMode: InstallMode.IMMEDIATE
        }).subscribe(status => {
            console.log(status);
        });
        this.splashScreen.hide();
    });
}

Solution

  • Do u use command ionic build --prod ? this conmand will not include cordova.js,so if app installed this package the cordova will not available, in ionic4 i use ionic cordova build android --prod to include the cordova.js and then release the www file to code push serve.it wokrs!