Ask HN: Is phonegap/cordova still relevant?
I did use phonegap a few years ago and it seemed very lacking. Partly the fact that phones were not powerful enough to make apps feel native enough. Has anything changed? Is it worth revisiting? Or should I give React Native a go instead?
(I am not planning to develop anything graphics intensive)
45 comments
[ 104 ms ] story [ 1291 ms ] threadNow that Xamarin is free, it's very hard to say no to such a powerful tool.
https://www.xamarin.com/forms
Meanwhile you still can share most of the code in the app.
Build for IOS/Android/UWP/Ubuntu/OSX all in the same base.
However, I don't think Cordova is necessary anymore with Xamarin.
I actively recommended against hybrid apps for years to people who hired me, but for the last year or so I would have felt safe recommending it with the caveats above. My experience is mostly with Ionic, which is a layer on top of Cordova, but I imagine most of these frameworks are the same.
Ionic hardly feels "native", especially since it is based on AngularJs which is dog slow to begin with. Stop overselling Ionic.
The ionic team did a great job of optimizing css, and managing routes/screen animations to follow the expectations on different platforms.
Angular is slow, but it's not that slow. It's fine for most apps. Stop underselling ionic.
Check out Ionic 2. Build something quick. Test on your phone.
You can even go graphic intensive with RN, it doesn't muddy you up if you need to do stuff with swift/obj-c.
Then don't write an app in a native wrapper, write a website if you cannot afford basic mobile app development.
- Offline (getting close with things like Service Workers, but not quite there yet)
- Geolocation (also getting close here in browser support, but not quite yet)
- Camera (caniuse suggests we're getting maybe close to browser support, but also not quite yet)
The particular canary in this coal mine (and clear when looking at caniuse stats) is that iOS Safari is still lagging a lot in some of these HTML5 "app platform" features. (I wish I could just ignore iOS altogether, but obviously there are a lot of iOS devices out there.)
http://caniuse.com/#feat=offline-apps -- Kind of supported everywhere, but deprecated in the standards for Service Workers because it is hard to maintain these manifest files
http://caniuse.com/#feat=serviceworkers -- Not supported hardly anywhere yet
Windows offers the option of offline, server-backed web apps using (among other pieces) the working draft W3C App Manifest standard (proposed by Firefox OS, unrelated to the other HTML5 manifest standard). Caniuse doesn't even track the App Manifest standard yet. ManifoldJS (http://manifoldjs.com/) provides a means to support iOS/Android via that standard, and you know how it works on those platforms? It's a Cordova-based wrapper.
Camera: http://caniuse.com/#feat=stream -- Not supported on iOS Safari, partially supported on Android
You can cheat with an iOS specific trick and fallback to a classic file upload control on Android (which Android and just about only Android turns into a camera/photo picker) and use the standard getUserMedia on Windows 10 (but not 8.1), or you can use the Cordova plugin that provides the same API for all of the platforms. (Not without its own bugs/quirks, but better than implementing four different methods.)
Geolocation: API is standard everywhere, yup, but in testing we've seen that Chrome and several flavors of Android like to use its network IP-based fallback provider when asked from a website even when the platform has location services on/available/permissions for the website; iOS sometimes returns strange or inaccurate results in the browser that you won't see in a native app. From Cordova we don't seem to have quite so many headaches getting seemingly accurate answers directly from platform location services.
All of that is before you get into the fact that there's still a psychological benefit to some of our users that they are installing a "real" .ipa or .apk rather than a shortcut to a website in their browser.
The better question may be a question of developer balance. React Native (and similarly Xamarin) requires extra work per each platform where things don't quite overlap and native controls are different enough on the given platform.
In terms of balance for a small team, "raw" HTML5 on Cordova can still be a time saver for reaching all the platforms with the exact same UI. Admittedly, yes that's likely not a true "native" UI and will look/feel more like a "website", but for some projects that least common denominator is more important the time/developer effort of polishing the UI especially for each platform.
And currently my favorite Android app is a Hacker News client written in Cordova.
Would I use it to write a game? Anything that runs in the background? Something that needs to start instantly and die instantly? No. But it's a great tool if it's paramount to keep platform support overhead to a minimum and you need to have something identical or similar running in the browser.
In particular, apps that:
* require native functionality (i.e. access to photos, GPS, notifications)
* are sufficiently complex UI-wise
... are not well served by Cordova. Why?
* when you start needing native functionality, you will find that the plugin ecosystem is often lacking; having to modify or write your own plugins means that you have suddenly have three languages (JS, Obj-C/Swift, Java) to contend with instead of two (Obj-C/Swift, Java)
* iOS and Android development kits make it easy to create apps that feel like they belong on their respective platforms — there is no need to spend developer or UI/UX looking for a library with lots of UI elements or developing a look/feel
Moreover, even relatively simple things like table layouts that "feel nice" — e.g. highlight when you tap on them, implement swiping to delete elements, allow for re-arranging — are significantly more onerous to implement in JS as opposed to natively.
If your app is sufficiently simple and doesn't fall prey to these pitfalls, you might want to consider Cordova. But if you really don't need native functionality, you might as well just get `UIWebView` working yourself.
Most people who actually do make money with Ionic/Cordova just go bazinga from these comments. So, I'm just gonna c/p what I wrote [here](http://tutorials.pluralsight.com/front-end-javascript/gettin...):
> ...at this point you may still say: Yeah, sure, but I've heard that React/Ember/NameYourPoison is way better. I will answer this question similarly as I did in a conference talk I gave a few months ago: Please just stop with the analysis paralysis already. Pick a framework (any framework for that matter) that the community is using, use it, and see how far it gets you. All these talks about X being slow or Y being better just make no sense until you try it yourself for your use case and preference.
With this said, I have to add that it would be unwise not to keep an eye on the 'latest and greatest' frameworks. So, please note that I'm not defending Ionic's honor, with all due honesty it has its problems (speed and lack of plugins to name a few - however, truth be told it has the most of the lot). And, if it's obvious that we would do way better with technology XYZ, I'd be the first to say 'K, no probs, let's learn and use it'. But, until Ionic (and soon Ionic 2) keeps showing results, I'll bet my money on that horse.
And now for a twist "heeey, but that NativeScript looks shineeeey!"
> Who are you, dude!? #3 at [StackOverflow in Ionic](http://stackoverflow.com/tags/ionic-framework/topusers), author of [Ionic book](https://leanpub.com/ionic-framework).
It will consume a lot of your time.
What I meant was that it works there(on iOS) seamlesly.
If you are not writing games, Ionic works really well, especially for shops with only a few developers.
In fact, I begin by prototyping all new app-ish projects as mobile web (twitter bootstrap).
Then, if we need better access to phone features (push messaging), I will simply wrap it in cordova.
Admittedly, I do have to fight with some plugins, but I try to not stray too far from well supported ones.
Also, you should know that you can get 60 frame/second on canvas. There are may casino slot style games that do just this. I believe flipboard does as well?
We utilize Cordova heavily in product I am working on, but more on a meta-layer, meaning, that user is able to create his simple application with drag-drop ui, see a preview in browser and then package it to a phone-installable file. We even had integrations for apparmor/apperian, so that the user is able to upload the app to their corporate app management right away.
If I were to build a single app, I would go native. Or xamarin, because I used it already, know how to get around its quirks, and like C# :)