-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open Source Hot Code Push / Over The Air Updates #43
Comments
For those looking to do remote app updates in their Capacitor apps, Appflow is a great choice, and it does have an API: https://useappflow.com/ If there's anything we can do to improve the Capacitor + Appflow experience please let us know. Otherwise, leaving this open for discussion on the topic of microsoft code push. |
We were willing to give a try to Appflow but even the 25k live updates / month (on the highest plan) is very limited considering that 1 live update = 1 device. In our case, that makes only 2 updates per months (for now, soon only 1) and maybe that could be enough but we don't want to be in the stress that we don't have a 'second chance'. So any plugin that could just do this job is very welcome 👍 |
We just need a pure plugin that offers API to manage(update, delete, add) web assets. |
I think updating/deleting assets in use might cause all sorts of issues with a running app so it's probably safer to move the downloaded files into a new directory and set the app to launch from that new folder (Plugins.WebView.setServerBasePath?) A good point though, a light touch native layer with an API to handle just the above, leaving the JS layer and the developer to handle the downloading and version checking etc themselves would great (and quicker/easier to develop). |
@alexcroox Those WebView methods are being pulled into Capacitor core for Capacitor 3, so the usage in native and JS may change slightly, depending on if we try to make it backwards compatible, but they'll still exist. Pretty sure they're all that's needed in Capacitor itself, but someone would need to build plugin(s) that use them. |
Maybe for some inspiration for a new Plugin. In the repository areo/capacitor-codepush something is used like |
After much experimentation these last couple of evenings I've made some progress on working this out:
In my case with the simulator this is:
Not providing a directory seems to put it in a
And voila the webview reloads automatically and I'm looking at the version of the app I have just downloaded (verified by including some different text in the UI)! 🚀 But now I'm stuck. Force quitting the app and re-launching no longer loads either app version, and just hangs on the splash screen without error. I can't work out where I went wrong in persisting it. |
If I may... This is more a business solution than a technical solution. AppFlow "works". No it is not free like CodePush. However, CodePush doesn't work that well with anything other than React Native. MS has a different business model and motive for giving away CodePush. @mlynch is not in the same position. I too was once upset about the price difference. I expressed it in blogs, forum, twitter, slack .. everywhere. FREE vs $50/month. Max changed his per app pricing to allow for smaller groups to be included without having to spend as much. He made a comprise. $50/app/month was extreme but again he and the Ionic team saw our pain and made the adjustment. For as much as Max and his team has given to us for $0. Is $49/month really make or break that we'd rather give it to Amazon/Azure directly? Wouldn't we rather give it to someone who will turn that into something that will directly give you a competitive advantage? What if? There was a plan below the 10k? Buy extra Deploys(i think there is already)? Rollover unused Deploys? To cut back on usage .. only use it on iOS since Android approves in <2hrs. Lastly there could be a DIY version where you build and host the artifact/manifest yourself and the Ionic Deploy API can read a manifest to determine when/if to download and apply it. This increases the risk you'll BRICK your app or it could get comprised. |
CodePush works great with our old Vue Cordova app so I'm not sure what you mean by the React Native comment. I got in contact with an Ionic rep to discuss enterprise costing because our user base (majority free) would quickly fall out of the low update cap per month the $49 offers. We were looking at $8,500 a year minimum for AppFlow enterprise which isn't possible for our startup, which is why we are looking at open source alternatives. |
@alexcroox Thanks for bringing up your story. This is the type of dialogue that would be great for the Ionic team to hear. First, I said "works well" with RN. It does work with Cordova now. There was a long gap from the previous version to AppCenter's version support of Cordova. I still don't find it as smooth as how it works with RN. Here's more of my opinion on their "low deployment numbers". I'd side with everyone in saying the number is low. I'd hope to have all my apps with more than 10K-25K users. It would be easy to just do a Native App Store deployment ONLY if I changed a native feature and let live Deploy do the rest. BUT! is that really a good idea? .. idk. What about this solution... it is a bit more work.. but would help keep the the number needed down to a minimum.
WIth this approach your App Store "LastUpdate" date is real. Your store version numbers are real. You minimize the need to rely 100% on over-the-air updates, but still able to get out critical fixes ASAP. Only active users in that 1-3 Day window will need to pull the Live Deploy. |
Thanks @levarberry. We're also working on a bunch of new updates to Appflow that should make Capacitor development even better. Also something to keep in mind with Appflow pricing: we're not charging you for the number of updates you make a month (in this case, one or two), we're charging on the delivery of those updates to your users which is what costs money (i.e. bandwidth costs). I think we'll see Appflow become much more interesting to Capacitor developers than anything coming from Microsoft as they are not focused on web devs building mobile apps. That being said, will definitely take this feedback into consideration as we think about how to better fit Appflow w/ the needs of the market. |
I found this package but its repository was deleted. |
@mlynch Prices that fit in the USA where GDP per capita is about 60k USD don't always fit in countries like Brazil where GDP per capita is about 8k USD. :/ |
@alexcroox There was another plugin for cordova at https://github.com/nordnet/cordova-hot-code-push that might be worth a look at for inspiration. I think it installs the new version into a new subdirectory, as you have done, but then copies/moves it into the default directory that the installed apk/ios app uses. (I'm working from memory from looking into this a few years back). Hope that helps - I'm not an ios/android developer, but would love a solution to this. I've been using Appflow, but the inability to get a good view of what's going on under the hood is causing me problems with an android build that's failing, and Ionic's support didn't spend any time looking into it even though I supplied the build reference, so I'm done with them. Andy |
Further to this, I've tried the line that @alexcroox used earlier (serverBasePath = await Plugins.WebView.getServerBasePath()) to get the html directory, and all I get is "public", not the full resolved path. I've tried: and I get "/" I've looked in Android Studio's Device File Explorer, and can't see any of the ionic app files in /data/data/com.app.name/ subfolders. Anyone got any idea how to view the files? Regards, |
@ap1969 it's been a while since I've looked at this but I seem to remember |
Just tried with AppCenter and, although the project hasn't called for support, it seems that by using their Cordova plugins AppCenter could work. I haven't tested with Code Push yet, but Analytics seems to be working. See my comment at microsoft/code-push#615 (comment) |
Has anyone seen this plug-in? Looks like someone has most of the basics coded (I have not tested it), but it looks simple enough: https://github.com/deveshmishra34/penpencil-app-update We too are in a similar situation. Appflow would be fantastic to use, but we have wayyyy more users than the pricetag allows. Problem is, our app is freemium (doesn't make much money yet) and we can't afford custom/enterprise pricing generally. I'd happily pay some regular fee for appflow membership, updates, if I could host and pay for update bandwidth myself without the exploding cost of per-update pricing on our mostly free / unpaid app. Anyway, that's why I'm here. |
Agreed and same here. We are just a totally-free community website who just want to use the mobile app to deliver more of a better UX. We are also OK to pay for some acceptable membership price but currently the pricing plan is just gonna cost us too far away from what we could afford with... We are also willing (and even prefer to - given that majority of our user is in China, the CDN out there are probably really slow in the internet environment here without a targeted optimization) to host our own hot update assets, paying the bandwidths ourselves. I know that the Ionic team and Capacitor team may have devoted tons of their spirit in this (and I appreciate that too - AppFlow seems to have a nice looking frontend UI), but again, given the current pricing plan, we are just unable to afford it at all. |
I gave up. This issue, and a total lack of interest from ionic when I raised an issue with the build of my android app on their Appflow service (despite me paying for it), made me look elsewhere. I looked at react native (nightmare in this area), nativescript (they have an OTA package in beta, but the creator has gone AWOL for 3 months). And I'm now back on Cordova with Quasar front end and MS code push. It works. |
@GalvinGao If you try that plugin, I'm interested to hear what your experience is like. As most things open-source, I'm guessing it would take some work, but I think a group effort could make it feasible. We're going to start looking into it in a month or so once we get to the "update our app-store apps" phase of our launch. |
I'll take a look on that recent days. That's being said, I also had a success (probably just a lucky one) with the AppCenter plug-ins (but not yet officially supporting Capacitor), mentioned here. |
I made https://github.com/mapiacompany/capacitor-codepush It forked from https://github.com/areo/capacitor-codepush and merge Install
it also require these plugins
ConfigurationAdd your deployment keys to the
Functions
Please try this plugin and Feel free to create PR. How to deployuse command
TODO
|
Fantastic effort so far @leo6104 thank you! |
Hey @leo6104, this looks like a great start! Thanks for sharing. Out of curiosity, it looks like this requires an AppCenter account - looks like they offer a quite reasonable subscription that includes "Distribute: Unlimited distributions and users"! We'll definitely look into this in a few weeks when we get into this part of the project. Unfortunately we aren't iOS developers, either :/ It looks like that is the last remaining open issue/blocker on your checklist, is that right? What is the feature that's not working on iOS? I'm not sure why it's referencing Cordova APIs? Is this code useful from the plugin I linked above? |
It requires AppCenter account and all free to use code-push deployment in AppCenter.
Right! it only have an issue with iOS
I share you current status.
|
@mlynch I will say that it would be great to have more transparent pricing on the enterprise-level options. We have quite a few clients and, with all due respect to sales people, there's nothing more frustrating than having to talk to them to get basic pricing information and then navigate an endless series of "JUST WANTED TO FOLLOW UP" emails until one or the other of you finally dies and can stop using email. |
@nonsenseless agreed, we rolled out much more pricing transparency recently which has been well received. Open to feedback if we're missing the mark still! https://ionic.io/pricing |
@mlynch Nice, this is definitely much improved! For the indie/startup plans, what kind of live update limits are there? And what kind of documentation do you ask for from start-ups? We work with a lot of folk developing MVPs so it would be helpful to have a clearer overview of the process and options to give them. |
@mlynch do you know the pricing of revenue cat ? |
@lincolnthree What exactly is needed here? Is there some basic documentation for the endpoints and how the cli works? I would be interested in hosting something for open source and other projects. Can we verify this plugin works as expected, more or less, and that only the URL needs changing along with the new endpoints and cli? Since you say it's not overly complex to implement the endpoints save for a pretty interface I would like to get this up and running and perhaps work on a nicer interface later, when it works. |
@jamesyoung1337 Awesome! Yes, I both helped develop this iteration of the plugin, and use it in production on over 100,000 devices. (iOS and Android). I think the best documentation is the source code of the client capacitor plugin, which is... typical for OSS, but of course not ideal :) Microsoft liked to keep their server API proprietary, and open-source the client stuff. Essentially the current Capacitor CodePush plugin makes two API calls:
It's really not much more complicated than any of the new solutions being proposed on this thread. It also already supports verifying the MD5 checksum and signed contents of the archive to prevent malicious updates / hacking. So as you can see, there is a lot of great / useful functionality in here that really would be quite easy to re-use with a few tweaks. It would be a shame to lose all of this work. What is needed is:
Anything beyond that, like a GUI to pause/roll back an update is just candy. I think this should be pretty easy to host straight out of GitHub or S3 using a JSON file, and possibly moving the version comparison logic to the client, to be honest. |
Here are some of the HTTP calls, which I believe happen solely in the TypeScript/JS, and not in native code: Check for update (code-push package included via NPM): Download the file: |
@lincolnthree Thank you, that is very helpful! I have been working my way through the source code, and I have the general hang of it as far as the appcenter cli goes. I will post a link to a github repo here when I have some legwork done. I'm interested in some details on how you have used in production: that was this plugin and maybe your own backend, localhost or your own server? I'm working my way through the commit history, will let you know how I get on. Thanks and talk soon! |
@jamesyoung1337 My pleasure! Perhaps we should move this discussion somewhere else. Possibly an issue in the Codepush Plugin repo? Happy to share more details off this main thread or via email / Discord: LincolnThree num 1078 |
@lincolnthree Yes, let's do that. An issue at your repo here? Discord channel: Capacitor and CodePush |
i just update
This will download the version and load it. |
I made it ! |
@riderx pls consider to create some UI around it to offer a commercial version, so you could support your solution long term :) |
@riderx Do you have a discord server we could all chat on? Possibly set up a server to collaborate? I am happy to get this started if it would be helpful. |
@lincolnthree you can join here : I'm working on the Android Version @o-alexandrov I'm not sure what I can do for commercial version. I will setup sponsorship account, I think it can be an easy solution too. |
Just released |
And Boom Found the way to persistency in Android with
|
https://github.com/riderx/capacitor-updater/projects this project works flawless |
Thanks @akashdusky the project have still few issue, but the idea was to make it very simple ! |
I foud the way to revert to original app ! |
Great work! @riderx |
After the manual mode of capacitor-updater to download updates. |
This feature was much needed as ionic charges too much for this . Thanks a lot @RiderXX |
1 similar comment
This feature was much needed as ionic charges too much for this . Thanks a lot @RiderXX |
@skjece ionic charge a lot, i agree, but for way more than live updates. |
If you want to automate that part try fastlane, I've used it for about 5 years now on various projects and it takes all the pain out of auto building and auto submitting to Apple/Android via CI/CD. Past couple of years I've had it running great in GitHub Actions https://docs.fastlane.tools/ |
@alexcroox it like all CI, it's scary to configure at beginning! Thanks a lot all for feedback and energy it helped me to start this wonderful project! |
Hey everyone, Features:
I would really appreciate your feedback. Feel free to create a discussion in https://github.com/capawesome-team/capacitor-plugins if you have any questions or send me an email (so we don't spam this issue). Have a nice day! |
That repo is amazing @robingenz ! |
Plugin Request
Name: Capacitor Hot Code Push
Package:
@capacitor-community/hot-code-push
Platform(s)
Android, iOS
Existing Solutions
MS Code Push - Free, very popular for Cordova, no Capacitor support yet
App Flow - Paid solution with very expensive plans given the low update limits. No API to upload built web directory on normal plans, not very flexible to binaries built elsewhere
Description
Over the Air Updates / Hot Code Push is the ability to update the js/css/html of your app in real time without having to go through the app store and waiting for reviews. This allows you to push critical fixes out quickly inline with your web app deployments instead of waiting days for Apple to approve entire binary updates.
It would be great if a plugin could facilitate over the air updates from a server/endpoint of our choosing where the developer controls the hosting of the OTA updates.
The key to the plugin is the ability to download a zip file of your updated dist folder, extract it, tell Capacitor to launch from this new directory until told otherwise.
There are other factors like verifying updates, choosing when to install them (forced on launch or next time the app is given focus after downloading etc), and optionally downloading only what has updated.
The text was updated successfully, but these errors were encountered: