What is CodePush?

Tharindu Ramesh Ketipearachchi
3 min readMay 26, 2022

--

01. What is CodePush?

In mobile applications, in case you need to send an update to your app ASAP with bug fix or any other improvement, it’s literally impossible. You have to submit the updated version to Appstore/Google Play and have to wait for their approval. This may take one day or even more.

CodePush is a solution to this problem. It allows us to update our application instantly without waiting for the app review process.

It’s a cloud service managed by Microsoft AppCenter, allows developers to instantly deploy mobile updates to end users. CodePush synchronises JavaScript code with any updates released to the CodePush server.

02. How CodePush works?

CodePush provided an sdk, which need to be embedded in our project. It’ll continuously listen to codepush server and if there any new update is available, it’ll download it to the installed application. When user restart their application or even when they are using it, they will be able to get these updates.

03. What technologies does CodePush Supports?

It doesn’t support for native applications. Only works for cross platform technologies.

  • React-native
  • Cordova
  • Flutter (doesn’t support directly. There are some workarounds)

04. What sort of changes which we can update via the CodePush?

No, we can’t update everything via the CodePush. It’s only allows us to send javascript file changes via this service. It’s pretty much similar to the changes that we can see from the browser reloading on web applications.

Library version upgrades, new package additions basically the anything which changes your package.json file and the changes to the segments which needs application restarts are not going to work. Instead they’ll crash your application which is on production and caused much severe issues.

Simply the changes that you able to view on simulator by doing the hot reloading, are the changes that can be sent via the CodePush updates.

05. Does Apple and Google allow this ?

Yes they do. Google allows this. Apple allows it as long as you don’t do dramatical changes to the application. If you are going to change the whole context of your application, such as converting your utility application to e-commerce one, then they’ll going to reject it definitely.

06. What are the risks of updating apps via CodePush?

It’s really critical to differentiate that what you need to update via the CodePush and what you don’t. Becasue if you do the don’t , there’s a 100% chance that it will crash your application which is running smoothly on the production. This might brings you up so many unwanted problems and ended up with the huge mess.

As we discussed in the 4th section, It’s only supports changes of the javascript files. But sometimes the javascript changes might fail as well. As an example if you use localisation library or something, those libraries initialise the selected localisation file and all other related configurations on the app start. If you change something on this localisation helper class, even though you have done it on the js file, the application need restart to restore the things up. These kind of changes will not be appeared by the hot reload and will crash the running application. It’s do the same to your production app as well.

So it’s really important to understand what to update via Codepush and what to not. I couldn’t find any automation script or service to do this verification process yet. But these days I’m working on it. If I’m able to succeed with it, I’ll definitely update you guys with another blog post.

07. Where to go from here?

The next step would be integrating CodePush for your application. It’s bit confusing when we have setup multiple targets on the same app. Don’t worry here we have explained everything on how to do that. Moving forward we should automate CodePush release process as well. Here we have nicely explained how to do it as well.

--

--

Tharindu Ramesh Ketipearachchi

Technical Lead (Swift, Objective C, Flutter, react-native) | iOS Developer | Mobile Development Lecturer |MSc in CS, BSc in CS (Col)