Ask HN: Is phonegap/cordova still relevant?

49 points by kyriakos ↗ HN
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 ] thread
I'm not a phone gap expert by all means, so I can't speak for it's new ability. But I wasn't very pleased with my experience when I did have to use it.

Now that Xamarin is free, it's very hard to say no to such a powerful tool.

If I am not mistaken doesn't with Xamarin mean you need to build the UI code once for each platform?
This says you can share 96% of the code base across platforms:

https://www.xamarin.com/forms

Xamarin Forms dev here. This is true. I wrote an audiotour app and I was able to reuse everything. The only thing I couldn't reuse was the audio player because of differences between platforms, but still you can use plain old Xamarin.Android and Xamarin.iOS. Pretty good results and you save ton of time.
curious is there design pattern for that? could you still have one code base similar to how different processors are compiled? or some kind of wrapper component? seems like there should be someone to write the code once and not need to make a copy.
Xamarin provides a bunch of generic controls that act as bridges to their corresponding platforms. It has enough flexibility that you can build the UI code from scratch for each platform, but you could probably put together a simple form based application with a single UI source.
Yes, and that is why those apps look and feel better - you use OS native widgets that users are familiar with and feel as their OS does.

Meanwhile you still can share most of the code in the app.

That's where React Native comes in ;)

Build for IOS/Android/UWP/Ubuntu/OSX all in the same base.

This is what I came here to say. Cordova is relevant, yes, and many people use it. For basic applications, Cordova applications can feel "native enough".

However, I don't think Cordova is necessary anymore with Xamarin.

I think Cordova is increasing in relevance. Over the last couple of years mobile devices have reached a level of performance that makes hybrid apps feel native. When you combine Cordova with Ionic you can create write-once apps that deploy to any device and have a native look and feel.
Not to dispute your assertion, but I've been hearing that PhoneGap/Cordova has 'felt native' for as long as it's been around, and that's never been true. Has it finally changed, and is it really worth it compared to e.g. writing an app in React instead?
It depends on your goals. If you're doing relatively basic things, a hybrid app can feel indistinguishable from a native app on iOS. Android is tough because the hardware varies so much. Displaying text fields, scrolling tables, images, etc. will work well and feel native on iOS and on higher-powered Android devices. Going outside of those lines into a lot of animation and that kind of thing is slower and will not feel native anymore.

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.

You might want to check out Framework 7 (http://framework7.io/). Discovered it only a few months ago and it's the best work I've seen so far to achieve a native look when using Cordova
> When you combine Cordova with Ionic you can create write-once apps that deploy to any device and have a native look and feel.

Ionic hardly feels "native", especially since it is based on AngularJs which is dog slow to begin with. Stop overselling Ionic.

It feels fairly native actually, there are cases where you can tell, but given the benefits, it's usually worth it.

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.

(comment deleted)
It's basically writing an angular app and sticking it on someones phone. Unless you're making a game, you can build some pretty powerful web apps and throw them into ionic to make an indistinguishable mobile app.
It's very much relevant. I've just built and released an app using Ionic 2. Nearing 25k users.

Check out Ionic 2. Build something quick. Test on your phone.

With the addition of React Native and Xamarin going free why would you? Hybrid apps will never feel native.

You can even go graphic intensive with RN, it doesn't muddy you up if you need to do stuff with swift/obj-c.

Some development teams can't afford the developer effort to polish UI specifically for every platform. For some apps it doesn't matter if it "feels native" if it can access the platform features it needs.
> Some development teams can't afford the developer effort to polish UI specifically for every platform. For some apps it doesn't matter if it "feels native" if it can access the platform features it needs.

Then don't write an app in a native wrapper, write a website if you cannot afford basic mobile app development.

That assumes a connection is always available.
No it doesn't, HTML5 has offline features.
I mentioned "access the platform features it needs". Off the top of my head, big things that still haven't yet quite crossed into the deeper web platform:

- 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.)

All theses are supported by any modern browser, you can launch the camera from your IOS browser, HTML5 support offline features without Service Workers and Geolocation works , there is not "not quite yet" for any of these 3 features there are here already.
Offline:

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.

Cordova is still quite relevant.

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.

I'm very happy building a frontend for an ERP system with Vue.js that works with the same codebase on Cordova and on web browsers.

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.

(comment deleted)
The first thing you need to ask yourself is do you need an app in a native wrapper or a simple website ? 99% of the time you don't need a website. There is plenty of ways to make a website work offline on mobile.
I am assuming you mean "99% of the time you don't need an app". My experience is that when a customer asks for an app, a mobile friendly website will usually meet their requirements AND be 1/3 the cost.
Lots of people are still using Cordova (especially for enterprise apps) and in-app browser support is getting better all the time. There's a huge number of upsides to having a single codebase that works on Android, iOS and the web. Native will obviously give the best UX but comes at a high cost which you have to weigh up against other factors. There's a very vocal group online that will tell you hybrid apps are the worst thing ever but when you do a hybrid app well most people don't notice.
I've worked with Cordova, and in many cases, I don't think it's appropriate.

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.

I agree, especially with your first point. I always say if you need more than one native plugin, Cordova is a poor choice. If your app is just a thin client for a bunch of cloud based services, it is a pretty good one.
(comment deleted)
A lot of “I’m not an expert, but let me tell you it sucks” stories.

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).

>With this said, I have to add that it would be unwise not to keep an eye on the 'latest and greatest' frameworks.

It will consume a lot of your time.

True, that's why I said only to 'keep an eye', and potentially check only ones that seem more than a mere hype. Of course, all in a reasonable 'not to get burned out' time frame (though, as you may agree, this means way too many things to different people).
All my apps (responsive HTML) are served via HTTP and rendered via WebView() api for both iOS and Android
Do your apps get approved by Apple? I have heard that they quite dislike this approach. Care to comment?
I haver never actually published an iOS app at the store, only Android.

What I meant was that it works there(on iOS) seamlesly.

Ionic is pretty good, especially if you are a developer that knows angular already (even more so if a webapp is your main business and it's already in angular).

If you are not writing games, Ionic works really well, especially for shops with only a few developers.

I find that they are quite relevant.

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?

Depends on what do you want to achieve?

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# :)

Absolutely! Despite critics, they can feel native due to increasingly better phone hardware and picking a good framework (KendoUI Mobile, Ionic, React Native, Xamarin). I use KendoUI Mobile and Knockout.js for mine currently, with plans to probably switch to Ionic someday. Users don't care what the tech is - it's about the experience. I've sold over $100k in apps over 3 years... just launched an Untappd beer app if you're curious - www.getBeerSwift.com.