Hello, im having a problem with de Code Push Plugin. This is the code that im using:
import { Component } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { StatusBar } from ‘@ionic-native/status-bar’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;
import { HomePage } from ‘…/pages/home/home’;
import { CodePush, InstallMode, SyncStatus } from ‘@ionic-native/code-push’;
import { AlertController } from ‘ionic-angular/components/alert/alert-controller’;
@Component({
templateUrl: ‘app.html’
})
export class MyApp {
rootPage:any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,
private codePush: CodePush, private alertCtrl: AlertController) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.checkCodePush(); //Use the plugin always after platform.ready()
});
}
checkCodePush() {
this.codePush.sync({
updateDialog: {
appendReleaseDescription: true,
descriptionPrefix: "\n\nChange log:\n"
},
installMode: InstallMode.IMMEDIATE
}).subscribe(
(data) => {
alert('CODE PUSH SUCCESSFUL: ’ + data);
},
(err) => {
alert('CODE PUSH ERROR: ' + err);
}
);
}
}
The problem is that after the app is updated i close the app, and it rollback to the previus version, but there are no error with the update. Someone can help me with this?