Once App is released to App Store or Google Play Store, fixing the bugs can be a hectic. While fixing one issue, whole app might get crashed. Any update that need to be made to Live app need proper testing and recompilation. In such case, we can use CodePush service.
CodePush is the cloud service provided by Microsoft which allows the app developer to deploy the new updates or changes directly to real app users. The CodePush automatically updated the JS code released to CodePush server so that app users do not have to update the app from app store. Like Git its act as an repository which is directly linked to Live app, any changes that needs to be made like image update, change in JS, CSS, HTML can be done. It creates a direct link with end users for solving bugs and issues without need to rebuild and distribute the app to stores.By default all React Native app created in App Center enables CodePush.
To enable CodePush to app, the app needs to be available to the App store or Google Play Store. We need the appstoreconnect or Google Console credential of apps already pushe to stores.
Lets setup the CodePush from creating AppCenter
Lets create new application and add new app.
For creating new app, screen will look like below:
Give a name to App
Select release type, OS and Platforms
We can configure the CodePush on three different ways:
- First : the build frequency allows us to run builds automatically when there is changes made for different platforms
- Second : the distribute build allows us to distribute the app to different app stores.
- Third : We can include the build script to package.json file which will run the post-clone, pre-build and post-build.
For the distribution of the app to app stores,
- Go to distribute section and under that select stores
- To connect we need respective store credentials
For the app deployment, go to CodePush option under distribute section. In there, select the enviroment.
- Under Settings you will fine the key for different enviroments
The React Native CodePush use its own server to store every copy of the deployment it makes if it needed rollback action. The CodePush operation is done by wrapping the app in CodePush HOC (higher order component) which checks for updated in code then reload app with new updates. This whole process is maintained and managed from control panel provided by Microsoft ( the images above). It also provide user the testing features of new version of app in different version of devices and platforms before releasing to app stores.
With the use of CodePush, developer can easily deploy the new update to store without any rebuild and deploy to app store. It saves lots of time and effort of development teams while making new major updates to apps.