React-native-code-push: App is force restarting after receiving updates

Created on 31 May 2018  路  8Comments  路  Source: microsoft/react-native-code-push

Hello everyonne,

I would like to ask. I got this problem.
I use this code push options:

  • Check frequency: ON_APP_RESUME
  • install mode: ON_NEXT_RESTART

But what happen is, my app is force restarting once it finished downloading the updates. This will make the users uncomfortable because users think that their app is restarting accidentally

Please help, is it bug from react-native-code-push or I use the wrong configuration ? What I want is the app will check updates every time it resumes, but install the app once the app is totally closed, and user can see the updates after they open up the app again

  • react-native-code-push version: 5.2.2
  • react-native version: 0.47.2

Most helpful comment

Hi @kevindavee please try to add one more code-push option mandatoryInstallMode:

const codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_RESTART,
  mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESTART
}

Please see this doc

All 8 comments

Hi @kevindavee ,
Thanks for reproting!

Yesterday I created test app with ON_NEXT_RESTART and it worked correct. Possible it is wrong configuration or some specific case. Could you please share your CodePush configuration in code, logs and platform? Also would be great if you will provide test project with reproducing issue and detailed repro steps.

Thanks,
Alexander

Hi @alexandergoncharov thank you for responding.

Can you please tell me more detail about the logs, where I can find it ?

For the CodePush configuration, here's the file:

class App extends Component {
  render () {
    console.disableYellowBox = true
    return (
      <Provider store={store}>
        <RootContainer />
      </Provider>
    )
  }
}

const codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_RESTART
}

export default codePush(codePushOptions)(App)

This issue happened in both Android and iOS. For the steps, I think it is as simple as I push my updates to code push, and then I open my app that is minimized (not closed). Then wait a few seconds, it will restart by it self.

About logs: You can start app from Xcode/AndroidStudio and see logs in output or use logcat command for android: https://developer.android.com/studio/command-line/logcat

But my debug app is not receiving updates. How can I log the result ?

How about my configuration ? Is it right ?

What version of react-native-code-push are you using ? Maybe I can try using that version @alexandergoncharov

Here's my log from XCode. I filtered using CodePush keyword. Hope it will help you to identify the problem

in App (at CodePush.js:504)
    in CodePushComponent (at renderApplication.js:35)
    in App (at CodePush.js:504)
    in CodePushComponent (at renderApplication.js:35)
2018-05-31 15:43:16.092 [info][tid:com.facebook.react.JavaScript] [CodePush] Checking for update.
2018-05-31 15:43:16.092683+0700 YumboxApp[12217:344785] [CodePush] Checking for update.
2018-05-31 15:43:17.347 [info][tid:com.facebook.react.JavaScript] [CodePush] Downloading package.
2018-05-31 15:43:17.347500+0700 YumboxApp[12217:344785] [CodePush] Downloading package.
2018-05-31 15:43:18.668 [warn][tid:com.facebook.react.CodePushQueue][RCTEventEmitter.m:54] Sending `CodePushDownloadProgress` with no listeners registered.
2018-05-31 15:43:18.668153+0700 YumboxApp[12217:344721] Sending `CodePushDownloadProgress` with no listeners registered.
[CodePush] Applying diff update.
[CodePush] Verifying hash for folder path: /Users/kevindave/Library/Developer/CoreSimulator/Devices/B0BBB5D3-4E3C-45ED-943B-06EFE0A3B7B4/data/Containers/Data/Application/6C5E7D2A-C6B6-48BC-8462-A855829B7D11/Library/Application Support/CodePush/8ecbd3982fafe83065f43a16caecfe2bb91207a6df01ae7bd52914947962d2bb
[CodePush] Manifest string: (
    "CodePush/main.jsbundle.meta:e906ec0d44b4a1ad3dd8b6ca185d4c869f469fa5cf26d8ea90efde45db25f45b",
    "CodePush/main.jsbundle:fce02edeb8ea4e12025103a5ef3c29e898abc0888f90541b1ee2c70dc9354340",
    "CodePush/assets/App/Images/Icons/[email protected]:fc7dd76200cfb120b9716c5b7f5e7dae50b02d7a6ad31c62469cce1befa3169d",
    "CodePush/assets/App/Images/Icons/[email protected]:7ebb69c03ecb443cb4090e3a163e2e69d542bdd4868ba3585173b150f10b3d3f",
    "CodePush/assets/App/Images/Icons/[email protected]:342f1ef4b16f4d8cb20d81c83dbdc63241e8f0d33bdccccde4a72ec189a840e7",
    "CodePush/assets/App/Images/Icons/[email protected]:874b7abb6ac8b80afd6b1a676c4ff4ba41c700158c4c4e886758b4e28a7e6409",
    "CodePush/assets/App/Images/Icons/faq-icon.png:afa33444f20f0640562c8adc89ec92e3eb083b380e0261d0295631b9fb123ab7",
    "CodePush/assets/App/Images/Icons/[email protected]:ad1b8d0129fc161927d89895f9d84fbddb2510f6f68b5f2b82b24069480d6273",
    "CodePush/assets/App/Images/Icons/ico
[CodePush] Expected hash: 8ecbd3982fafe83065f43a16caecfe2bb91207a6df01ae7bd52914947962d2bb, actual hash: 8ecbd3982fafe83065f43a16caecfe2bb91207a6df01ae7bd52914947962d2bb
[CodePush] The update contents succeeded the data integrity check.
2018-05-31 15:43:19.343 [info][tid:com.facebook.react.JavaScript] [CodePush] Installing update.
2018-05-31 15:43:19.343212+0700 YumboxApp[12217:344785] [CodePush] Installing update.
2018-05-31 15:43:19.350 [info][tid:com.facebook.react.JavaScript] [CodePush] Restarting app
2018-05-31 15:43:19.350319+0700 YumboxApp[12217:344785] [CodePush] Restarting app
    in App (at CodePush.js:504)
    in CodePushComponent (at renderApplication.js:35)
    in App (at CodePush.js:504)
    in CodePushComponent (at renderApplication.js:35)
2018-05-31 15:43:20.815 [info][tid:com.facebook.react.JavaScript] [CodePush] Checking for update.
2018-05-31 15:43:20.815533+0700 YumboxApp[12217:344940] [CodePush] Checking for update.
2018-05-31 15:43:20.822 [info][tid:com.facebook.react.JavaScript] [CodePush] Reporting CodePush update success (v85)
2018-05-31 15:43:20.821761+0700 YumboxApp[12217:344940] [CodePush] Reporting CodePush update success (v85)
2018-05-31 15:43:22.914 [info][tid:com.facebook.react.JavaScript] [CodePush] App is up to date.
2018-05-31 15:43:22.914113+0700 YumboxApp[12217:344940] [CodePush] App is up to date.
    in App (at CodePush.js:504)
    in CodePushComponent (at renderApplication.js:35)
    in App (at CodePush.js:504)
    in CodePushComponent (at renderApplication.js:35)

By the way, everytime I push my updates to CodePush, I use --mandatory. Is it affecting this issue ?

Hi @kevindavee please try to add one more code-push option mandatoryInstallMode:

const codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_RESTART,
  mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESTART
}

Please see this doc

@kevindavee I tested your code example - no issue found. And --mandatory update installed by forcing restarting as @NickToropov noted.
So, if you would like to install your update on next restart you should use pushing update without --mandatory option or set install mode for mandatory updates as provide @NickToropov above.
For our recommendation use --mandatory option only if you really need it. For more information please check docs: https://github.com/Microsoft/code-push/blob/master/cli/README.md#mandatory-parameter

Please let me know if it was helpful for you and it resolved your issue or not.

Thanks,
Alexander

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ninjz picture ninjz  路  4Comments

kevando picture kevando  路  4Comments

Fuhrmann picture Fuhrmann  路  3Comments

osdnk picture osdnk  路  3Comments

DeDuckProject picture DeDuckProject  路  3Comments