react-native-code-push
react-native-code-push copied to clipboard
Install Mode ON_NEXT_RESUME not working on Android
Steps to Reproduce
- Using the following options when calling sync
await codePush.sync({
installMode: codePush.InstallMode.ON_NEXT_SUSPEND
mandatoryInstallMode: codePush.InstallMode.ON_NEXT_SUSPEND
})
Expected Behavior
When putting the app in background, the update should be properly installed. When resuming the app to active status, it should work, even if showing a white screen for a short time.
Actual Behavior
When putting the app in background, I can correctly see the update as installed on appcenter dashboard. When resuming the app to active status, a white screen is showed and the app get freezed in this status.
Environment
- react-native-code-push version: 6.0.0
- react-native version: 0.61.5
- Android version: 10
- same behaviour in both in simulator or in phisycal device
Hi, @TommyBez , Thanks for reporting!
Unfortunately, I can't reproduce this issue. Could you please provide logs during update and also it will be helpful if you provide some demo app with reproducing issue and reprosteps. Please let me know if you have any questions.
Hi @alexandergoncharov,
Thank you for your prompt response!
Unfortunately, I'm not currently able to provide a demo app.
I will add logs for sure as soon as possible.
In the meantime, I would add more details regarding my implementation.
I'm using react-native-navigation (6.3.1) and for this reason I'm not wrapping my root component with Code Push HOC.
I'm initializing code push in my start-up function, calling this initialize
method:
const initialize = async () => {
await sync()
AppState.addEventListener('change', async newState => {
if (newState === 'active') {
sync()
}
})
}
const sync = async (options = {}) => {
const update = await codePush.checkForUpdate()
const minimumBackgroundDuration = update?.isMandatory
? 0
: MINIMUM_BACKGROUND_SECONDS
await codePush.sync({
installMode: codePush.InstallMode.ON_NEXT_SUSPEND,
mandatoryInstallMode: codePush.InstallMode.ON_NEXT_SUSPEND,
minimumBackgroundDuration,
...options,
})
}
This is working properly on iOS but not on Android.
I had the same problem with react-native 0.63.3 and react-native-code-push 6.4.0 IOS is getting the code push , and Android doesn't. @TommyBez @alexandergoncharov any update ?
@galdanay Unfortunately I haven't found a solution yet. Still searching the time to investigate deeper.
I am also experiencing the same problem on Android, with react-native 0.63.4, using react-native-code-push v6.4.0. I am also using react-native-navigation v7.8.1 by Wix, which seems to have some known issues from the earlier versions.
In my case, I am seeing that the update does get installed, and gets applied successfully after the app resumes. However, as described in the issue above, my app also gets stuck on a white screen. The only way to resolve this is to kill the app and restart.
@helenkuang Did you manage to figure it out? My use case is the same as yours so I'm struggling with the same issues.
@riordanpawley Unfortunately not. Right now, we're just using installMode: codePush.InstallMode.ON_NEXT_RESTART
, which is not our preferred way for CodePush to work for our app, but it gets the job done.
Yup, this is the case for everyone, on 0.63.x and later only ON_NEXT_RESTART works for android!
@alexandergoncharov literally to replicate just call CodePush.restartApp(false)
and watch the app crash!
Can someone look into that, mandatory updates crash the app
Bump.
Seeing the same issue on our android app with react-native-navigation. Using react-native v0.63.4 and react-native-code-push v6.3.0. If this has been addressed in. any future version, we can upgrade. But based on this thread, it doesn't look like it has. We are using the following config
CodePush.sync({
installMode: CodePush.InstallMode.ON_NEXT_SUSPEND,
minimumBackgroundDuration: 40,
});