1

I am using plugin https://github.com/Microsoft/cordova-plugin-code-push#codepushnotifyapplicationready After new version of app is pushed I can see that app was updated on my device after I launched it. In console I can see that everything is fine, but after closing and starting app again it shows me old version, but saying that App is up to date. In console I can see that this.codePush.getCurrentPackage() really shows the last and proper update description, but the content isn't fine.

My update code is very simple:
checkCodePush() { this.codePush.sync({ updateDialog: { appendReleaseDescription: true, descriptionPrefix: "\n\nChange log:\n"
}, installMode: InstallMode.IMMEDIATE }).subscribe( (data) => { console.log('CODE PUSH SUCCESSFUL: ' + data); }, (err) => { console.log('CODE PUSH ERROR: ' + err); } );
}

For more, I can say that when I plug in my phone to Chrome Dev Tools and update app for the first time, then it is okay, but after I refresh the page there is an information that page couldn't be loaded because of missing http://file///data/user/0/io.ionic.starter/files/codepush/deploy/versions/961f76070b3b2dbff9ba5883c5b2d1b2db5f3a267d87a24d9688c761040e7b51/www/index.html

Also, there isn't any info about rollback.

I will appreciate any help.

krzyhub
  • 6,285
  • 11
  • 42
  • 68

1 Answers1

1

It really sounds like the "notify application ready" may not be called right away at app startup. I would put that as close to the platform ready event firing as possible:

CodePush.notifyApplicationReady();

Also, when your Android device is connected, you could run below to get some code-push specific log info. That may help chase down what you're seeing too:

code-push debug android

BRass
  • 3,698
  • 2
  • 28
  • 46
  • I added `CodePush.notifyApplicationReady();` inside and outside the platform ready event firing, but it didn't change anything. Also when using `code-push debug android` I can't see any error, everythig seems to proceed successfully. The issue occures not only on my device. By the way, could you tell which place for `CodePush.notifyApplicationReady();` is proper? Inside platform ready firing event or outside? After or before sync funcion call? – krzyhub Sep 21 '18 at 15:26
  • Should be inside platform ready, before any calls to `sync`. If you are calling it inside and outside platform ready that could be a problem. You may be causing issues trying to use the code push plugin before it's ready. – BRass Sep 21 '18 at 15:44
  • What commands do you execute when you generate a build and send it to code push? – BRass Sep 21 '18 at 16:06
  • `ionic cordova build android` and then `code-push release NameOfMyApp 0.0.1 -m --description "Some changes" -d "Production"` – krzyhub Sep 21 '18 at 16:28
  • I run `code-push release-cordova` (not just `release`). It may not be related to what you're seeing, but I know the `release-cordova` command does some helpful cordova-specific things. – BRass Sep 21 '18 at 18:27
  • Tried with `code-push release-cordova myapp android -d "Production"` but issue still occurs :/ – krzyhub Sep 24 '18 at 07:02
  • It's likely not related, but you probably should look at upgrading to "App Center" for the CLI. Microsoft moved Code Push to their new App Center system. As far as I know the Code Push Cordova plugin (SDK) is still supposed to be used as-is, but the CLI to generate/monitor builds is supposed to go to App Center. The old CLI is supposed to work through September, but it may be a piece of the puzzle: https://learn.microsoft.com/en-us/appcenter/distribution/codepush/migrationguide – BRass Sep 24 '18 at 13:42
  • Thank you for your help, but event with "App Center Cli" things didn't changed in the app on device, same on the emulator. I created an issue on code-push github repository. Maybe there I will find the answer... – krzyhub Sep 24 '18 at 17:08