Blog

Mobile Magic and Appy Days - What is CodePush and why does the OVO App use it?

  • 26 April 2021
  • 5 replies
  • 181 views
Mobile Magic and Appy Days - What is CodePush and why does the OVO App use it?
Userlevel 7
Badge +3

Have you ever noticed how the OVO Energy apps seem to change sometimes, even when there’s not been an update on the App Store or Google Play Store? That’s because there’s more to it than meets the eye. And this is where some clever magic called CodePush comes in.

 

Wait… CodePush? What does that do?

 

Well, it’s a bit complicated but the basic concept is that a developer can create a mobile app that’s like a sort of website, blending the best of both worlds together. It also means the same code can be used for both the Android and iOS versions of the app, since CodePush takes care of making the app compatible on both platforms on your behalf.

 

What does this mean for OVO’s developers?

 

Speedier app updates! The developers don’t have to work on two different versions of the same feature, they can create it once and it just works. 🙂 It also means that any bugs that are fixed in the Android version of the app, are usually fixed on iOS at the same time. :blush:

In fact, there’s a few cases where bug reports from this forum resulted in same-day fixes delivered via CodePush too!

 

What do I get out of it? Does this benefit me as well?

 

Yup. Very much so. Whenever OVO deploys any CodePush related updates, everyone gets access to them all at the same time. There’s no delays or anything that gets in the way to slow things down (but OVO can throttle particular updates if they’d like to). As a result, you get new features and bug fixes much faster. Everyone wins!

As for me? Well, as a bug hunter, I can take advantage of CodePush by knowing that I’m always on the latest updates whenever I’m trying to break the app. It would also allow OVO to put me onto a faster “testing” release track if they wanted to, without affecting anyone else. Which could be useful for bug hunting…

 

Could the app not just be updated only via the App Store and Google Play Store?

 

That’s true. But then it wouldn’t be as easy for OVO’s development team to work on it and the app wouldn’t be as good. It would also double the workload, making everything take twice as long. Given that MyOVO is custom built in-house by OVO’s own developer teams and gets constant updates, it’s actually a good thing to have the OVO Energy apps being able to keep up with MyOVO as well.

 

So… How does the app get updated then?

 

Hehehe. Clever wizardry! There’s actually not one, but two methods that OVO releases updates to the OVO Energy apps. You’re probably familiar with how most apps are updated via the App Store and Google Play Store, and this is of course still the case with OVO as well. However, some of the smaller “mini updates” are delivered via CodePush directly to the app. These mini updates are able to be handled live without needing a full app update being posted to the stores. Clever eh? :wink:

It’s important that you still update the app via the App Store and Google Play Store anyway as usual, since certain things can’t be done via CodePush. But for the CodePush related updates, you can just use the app as normal. CodePush looks after itself. Hehehe.

 

So… Why the infinite spinning circle then? Whenever I launch the app, I get stuck on this thing! The app is completely broken and I can’t use it.

 

Erm… Yeah… That’s kinda my fault. Sorry! :disappointed_relieved: But I’d like to explain why this is happening. The app isn’t actually broken. There’s more to it than meets the eye.

CodePush uses something called Delta Updates whenever it does a refresh, in which it only pulls down the things that have changed, rather than absolutely everything. It’s a pretty neat trick which makes the in-app updates much faster, but it can be a bit quirky at times - and it also depends on the settings! The first download also has to start from having nothing yet, so the first refresh is the biggest and pulls down basically everything. Future updates will pull down only the new stuff. This doesn’t apply to the updates via the App Store or Google Play Store though, only the stuff within the app itself.

A few months ago, I managed to figure out why members kept getting booted out of the app and I also managed to identify an ingenious solution which got OVO’s developers very excited. They managed to deploy the fix just a few days later. It was perfect in that it definitely solved the random logouts, but there was a slight… Flaw… In my solution. :open_mouth:

While my suggested fix definitely solved the random logouts, it suddenly caused a new bug to happen which I hadn’t considered. As a result, when the original bug got fixed, it causes the app to only install new updates that CodePush pulls down when the app is restarted or resumed, rather than completely randomly. It seemed perfect if it wasn’t for a minor snag…

Guess who forgot to suggest adding a progress indicator. Yeah… I didn’t think of that at the time…  :joy:

As a result, the app now shows a spinning circle when a refresh is in progress. This might make it look as if the app is “broken” when it’s actually not broken at all. It’s probably just setting itself up! I’ve since made that suggestion, which is currently being looked into.

Update (03/06/2021): This bug has now been fixed too! 

 

Doesn’t this use a lot of data? I’m on a tight data allowance!

 

Nope! :sunglasses:  That’s the beauty of Delta Updates. Other than the first download (which CodePush often refers to as a “Sync”), each download is usually pretty tiny and you’ll ultimately use less mobile data on your phone by using the OVO Energy apps than you would by using MyOVO via the mobile site. Not least because all the assets will already be downloaded, so there’s less of a need to download them all over again. Don’t forget you can always use Wi-Fi as well, especially for that first download!

 

I’ve got this spinning circle bug and it’s preventing me from using the app! What do I do?

 

If you see this, simply hang in there for a few minutes and you’ll be in. I’ve tested this many times, so I know it’s works. Don’t quit the app, uninstall/reinstall or anything. Simply leave it on-screen and you’ll be in once it’s ready. If you try to do anything to “fix” the app, you’ll interrupt the download and it will only slow things down further. :wink:

Even on Dial-Up Internet, the app will eventually finish getting itself ready, it just might take a little bit longer… :rofl:

 

Will this be fixed soon?

 

Update (03/06/2021): This bug has now been fixed!

 

What happens if I uninstall and reinstall the app, or do a Clear Data on it? And why is the app showing up with huge amounts of storage under “Data”?

 

As with all apps, it does exactly what it says on the tin. :relaxed:

However, because CodePush puts all the stuff it downloads into “Data” since it can’t go into the “App” itself, these downloads can’t be retained if the app is uninstalled/reinstalled or you clear the app data. As a result, uninstalling the app or doing Clear Data on it basically wipes out everything CodePush has ever pulled down and causes the app to go back to it’s original state. This also means you’d have to allow CodePush to download everything all over again. I don’t recommend doing this to try to “fix” the app unless you absolutely have to. If you’re having problems with the app, you might be able to get help from this forum first. We can usually get ya back on the road!

 

I still think the app is broken! What can I do?

 

Uh-oh. That might not be good. If it’s been more than 10 minutes with the app “stuck” on the spinning circle, reinstalling the app or clearing out the app data won’t help, as you’ll end up starting again. The way Delta Updates work means it’s also nearly impossible to get a corrupted update downloaded that bricks the app completely. If CodePush isn’t happy that it pulled down the right stuff, it won’t apply it and will retry the download later. It will always try to leave the app in a usable state at all times.

However, here’s some tips you can try.

  • Check for and install any pending updates to the app on the App Store and Google Play Store. Some of those might help!
  • Completely quit the app from the recent apps switcher, then relaunch
  • Restart your device. Most Android devices have a Restart option, but for iOS/iPadOS, you’ll have to turn your device off and back on again in two steps.
  • Make sure you’ve got an internet connection! The app won’t work very well if you’re offline.
  • Try giving it a few more minutes with the app open and on-screen. You might get lucky.
  • Try again in a little bit. The server might be down, but it should be back later
  • Still no luck? Give us a shout via the forum! Forum volunteers such as myself might be able to figure out what’s happened.

 

I’ve seen some of your bug reports mention things like “Totodile” and “CodePush Version” a lot. What’s all that about?

 

Good question! Totodile is the name of my current smartphone that I use, and it’s also the one that I do a lot of bug hunting with. Given that the all the device info and other important details about Totodile are now on file and known to OVO’s teams, it’s easier for me to reference it this way than to keep typing them out. :smile:

As for the CodePush Version and App Version… It’s extremely useful to ask for both, since it helps the developers know what state your app is in (great for bug reports!) and also helps volunteers like myself to know if your app has fallen behind when we’re helping out. This also helps us to give better advice. If you ever need to find them, head into the app and go to Account > App Details.

 

Do I ever need to force CodePush to run a manual Sync?

 

Nope! That’s another magic trick. If CodePush notices that it’s fallen behind, it will attempt to catch up by itself. Simply keep the app open and use it as normal in the meantime. You’ll soon have the latest goodies ready to go!

 

I just checked the CodePush Version and it’s got dashes instead of a number. What do I do?

 

You probably don’t need to do anything here. If you’ve got dashes instead of a version number, it’s most likely because CodePush hasn’t installed anything since you last installed or updated the app via the App Store or Google Play Store.

The two most common reasons for this are:

  1. You’ve only recently installed or updated the app and CodePush hasn’t yet had chance to refresh itself - but it’ll soon catch up!
  2. There might not be anything available right now that’s newer than what the app already has and CodePush has never done a refresh.

Neither of these will cause the app to break of course. It simply means you’ll only have the basics available. Once CodePush catches up, everything will be refreshed.

 

I’m still a bit confused. Can you help me with the app?

 

Sure. We’d be happy to! While this forum is volunteer led and we’re not part of OVO’s developer teams, we do know our way round things. Feel free to ask for help here or report any bugs anytime. We’ll always make sure you’re looked after.


5 replies

Userlevel 7

As ever some great technical know-how from our resident bug-catcher, @Blastoise186, I think I even understand this CodePush malarkey now!

 

 We’ll make sure the App team get the chance to read this too so they may want to take you up on that bug-catching ‘fast release’ track... 

Userlevel 7
Badge +3

Hehehe!

At first, I will admit that I wasn’t a fan of CodePush and actually wanted to suggest deprecating it for something else. But I’ve actually grown to like it since as a user, since it’s pretty cool stuff once you’ve gotten used to it. Can you make sure to let the Support Team and Social Media Team know about this thread as well @Jess_OVO ? It may prove… Useful…

Userlevel 7

Glad to hear you’ve grown to like our friend CodePush, @Blastoise186!

This blog proved very useful to the App team who really liked the suggestion for a progress indicator and are going to look into this - progress on showing progress! Great work! :blush:

Userlevel 7
Badge +3

Hehehe. It’s almost like I’ve become an “unofficial” member of the dev teams these days!

I’m no developer, but I know my way round bug hunting. And I know how to implode apps that are built using Apache Cordova and React Native alright!

A fix like that is probably a breaking change that I don’t think can be done via CodePush, so it’ll probably have to go out in a full app update. I’ve had some pretty bad experiences as a user in the past, mainly with apps that used Adobe PhoneGap rather than the open-source Apache Cordova. CodePush simply integrates with stuff like Apache Cordova and React Native, rather than re-inventing the wheel like Adobe did. Clearly someone has learned from old mistakes. :)

Let’s hope that I don’t need to conjure up yet another ingenious fix for this ingenious solution that fixes the fix for the original ingenious solution to the double login issue. :rofl:

Userlevel 7
Badge +3

I was just reading through some of the reviews for the app on Google Play, when I came across one from a couple of months ago. I sometimes look through places like Trustpilot and the Google Play Store to pick up on possible signs of bugs to hunt for, it can prove useful!

The good news is that I’ve started to spot signs that the Social Media Team has seen this blog and has changed tactics with their responses to low scoring reviews. I wonder how many other members of the Social Media Team and Support Team have discovered this thread...

Reply