Update package
I'm with a problem in the update after update it installs what was downloaded but after you close and open the application sometimes it shows again that has update, or whether it is the same update .
my code:
var onPackageDownloaded = function (localPackage) { localPackage.install(onInstallSuccess, onError); }; var onUpdateCheck = function (remotePackage) { if (!remotePackage) { console.log("The application is up to date."); } else { console.log("A CodePush update is available. Package hash: " + remotePackage.packageHash); $scope.startUpdate = function(){ remotePackage.download(onPackageDownloaded, onError, onProgress); $scope.aceppted = true; } } }; window.codePush.checkForUpdate(onUpdateCheck, onError, deploymentKey);
*Thank you, I'll wait.
Hi @BrunoFDeveloper. I see you are using our advanced API. My understanding of your problem is that sometimes, after you close and reopen the application, you get reverted to the previous version of the application, after an update.
That sounds like you are not calling window.codePush.notifyApplicationReady() after you install the update. We recently made a change that protects users from bad updates by default, so calling this is required. We recommend you to call it on every application start, since this is a noop in case the application was not updated. For more information about this, please see the function's documentation.
If this is not the problem, please send us more details about the issue, like:
- What version of the plugin are you using?
- When do you want the update to be applied? (on resume/on restart/immediately) I see you are using the default mode in your example, which is applies the update on the next application restart.
Thanks!
Hi @dlebu.
Thank you very much for your help!
It was exactly the function call, had not seen about it , thank you.
window.codePush.notifyApplicationReady()
@BrunoFDeveloper Thanks for using CodePush and please keep the feedback coming!