React-native-code-push: code is only gettig updated on restarting the app after codepush update

Created on 31 Oct 2018  路  7Comments  路  Source: microsoft/react-native-code-push

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

in my index file
let codePushOptions = { checkFrequency: CodePush.CheckFrequency.MANUAL }; AppRegistry.registerComponent(appName, () => CodePush(codePushOptions)(App));
and in the app. have added the sync method in componentDidMount like this
CodePush.sync({ updateDialog: true, installMode: CodePush.InstallMode.IMMEDIATE }, this.codePushStatusDidChange.bind(this), this.codePushDownloadDidProgress.bind(this) )

Expected Behavior

To Update code shown inside the app when the update arrives

Actual Behavior

What actually happens?
The code is updated when the app is opened the second time.
Here is the log

`[03:25:20] Expected hash: hashkey, actual hash: samehashkey
[03:25:20] The update contents succeeded the data integrity check.
[03:25:20] Verifying signature for folder path: /data/user/0/com.packagename/files/CodePush/somestring.
[03:25:20] JWT verification succeeded, payload content: {claimVersion=1.0.0, iat=Wed Oct 31 15:24:49 GMT+05:30 2018, contentHash=contenthash}
[03:25:20] The update contents succeeded the code signing check.
[03:25:20] Loading JS bundle from "/data/user/0/com.packagename/files/CodePush/someString/CodePush/index.android.bundle"
[03:25:20] Unable to set JSBundle - CodePush may not support this version of React Native
[03:25:20] Restarting app

when I manually close the app and restart
[03:31:06] Loading JS bundle from "/data/user/0/com.somepackage/files/CodePush/somestring/CodePush/index.android.bundle"
[03:31:07] Reporting CodePush update success (v10)

Environment

  • react-native-code-push version:5.4.2
  • react-native version:0.56.0
  • iOS/Android/Windows version: Android- 8.1
  • Does this reproduce on a debug build or release build? releaseStaging
  • Does this reproduce on a simulator, or only on a physical device? physical divice
bug investigating no-response

All 7 comments

Hi @saranshagarwal ,
Thanks for reporting!

It looks like that you have some issue with setting bundle for IMMEDIATE but then it is set successfully after reloading.
Could you please provide some dummy project with repro steps? I would like to debug it.

Thanks,
Alexander

This would take some time since now I am working on a different version of react-native for my other projects(shifting version was a pain). I am adding the basic files that would reproduce this code in an empty project with react native version .56.0.
This url. contains two files. index.js and app,js Please check. Apologies for the inconvenience.If this causes trouble just let me know. Will create a project.
Thanks,
Saransh Agarwal

Sure, I'll try to reproduce issue with this example and let you know results.
Also, which approach have you used for installing CodePush? With link command or manual?

I have used the link command but made sure everything matched with the manual instructions

Hello @saranshagarwal,

I've created some simple app to test:

  1. code-push app add Issue1442-android android react-native
  2. Copied Staging deployment key
  3. react-native init --version="0.56.0" Issue1442
  4. yarn add react-native-code-push
  5. react-native link react-native-code-push, pasted Staging deployment key for android.
  6. Replaced App.js with your version of this file, fixed it a little bit.
  7. Added bundleInDebug: true in ./android/app/build.gradle (to test the app in debug mode without a bundler)
  8. Made codepush release with CodePush bundle! text (code-push release-react Issue1442-android android)
  9. Replaced this text with Built in bundle!
  10. react-native run-android

Result

Demo

You can check this demo app [here] (there is a README).
Can you test it and share the results with us?

Hi @saranshagarwal,

I'm going to close this issue for now as I haven't heard from you in a while, unfortunately.
Please feel free to reopen it if you have any questions.

Hello @saranshagarwal,

I've created some simple app to test:

  1. code-push app add Issue1442-android android react-native
  2. Copied Staging deployment key
  3. react-native init --version="0.56.0" Issue1442
  4. yarn add react-native-code-push
  5. react-native link react-native-code-push, pasted Staging deployment key for android.
  6. Replaced App.js with your version of this file, fixed it a little bit.
  7. Added bundleInDebug: true in ./android/app/build.gradle (to test the app in debug mode without a bundler)
  8. Made codepush release with CodePush bundle! text (code-push release-react Issue1442-android android)
  9. Replaced this text with Built in bundle!
  10. react-native run-android

Result

Demo

You can check this demo app [here] (there is a README).
Can you test it and share the results with us?

Have you tried this with proguard enabled? App is not getting refreshed only when proguard is enabled. If it's false it changes automatically.

This issue resolved my problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EdmundMai picture EdmundMai  路  4Comments

diegocouto picture diegocouto  路  4Comments

fanzhiri picture fanzhiri  路  3Comments

Adr1ann picture Adr1ann  路  3Comments

Fuhrmann picture Fuhrmann  路  3Comments