Search code examples
react-nativecode-pushreact-native-code-push

How to show an notification after successful app update via Code Push


I'm using code-push to update my react-native app. I do not want to update it every time via App Store.

I'm using installMode ON_NEXT_RESUME, thus the update is downloaded but not installed immediately. The new content will be available the next time the app is resumed or restarted, whichever event happens first. (if the app was inactive for 10 mins)

My code is as follows:

componentDidMount() {
    codePush.sync({ installMode: codePush.InstallMode.ON_NEXT_RESUME,
                    minimumBackgroundDuration: 60 * 10 });
}

But the problem is than the app is updated but the user doesn't know it.

Is there any way to show an notification of something like that to user after successful update?


Solution

  • You can use

    codePush.SyncStatus.UPDATE_INSTALLED
    

    https://github.com/Microsoft/react-native-code-push/blob/master/docs/api-js.md#codepushsync