0

description:

I use code-push in a cordova project.On Android device, when I call codePush.sync, the updated package will be downloaded and installed correctly(no error) and I can see all the changes.But when I resume to the app next time, all the changes are gone and the app rollback to old version.

how I sync:

if (window.codePush) {
  const InstallMode = window.InstallMode;
  window.codePush.sync(syncCallback, {
    deploymentKey: window.device.platform === 'Android' ? CODE_PUSH_KEY.android : CODE_PUSH_KEY.ios,
    installMode: InstallMode.IMMEDIATE
  });
}

how I release:

code-push release-cordova block-chain-android android --deploymentName ${environment} --des "${description}" --targetBinaryVersion "^2.0.0"

what's possibly going wrong:

cordova run the different index.html in the different path.

when the app was first installed: 01-02 19:30:19.719 15422-15422/? D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)

And then the update was installed and restarted: 01-02 19:31:55.424 15422-15422/? D/CordovaWebViewImpl: >>> loadUrl(file:/data/user/0/com.test.testApp/files/codepush/deploy/versions/62b60c3f481e89c83d5fd6d7f215133aa16bf800cde246f0453f073224e55e52/www/index.html)

Finally the app was resumed after we did see the changes: 01-02 19:32:18.029 15422-15422/? D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)

related versions:

  • cordova-android: 6.4.0
  • cordova-plugin-code-push: 1.11.16

Did I miss anything after the package was downloaded and installed, like tellCodePushToCopyIndexHtml

Halt
  • 1,055
  • 9
  • 18

1 Answers1

0

Solved.

I forget to call codePush.notifyApplicationReady() in the deviceready like document.addEventListener('deviceready', () => { window.codePush.notifyApplicationReady() }, false);

Halt
  • 1,055
  • 9
  • 18
  • didn't worked for me. using it with vuejs. `` document.addEventListener("deviceReady", function(){ codePush.sync(); codePush.notifyApplicationReady(); }, false); `` facing same problem as you. – Amit Kumar Khare Apr 18 '21 at 15:12