There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. -Phil Karlton + Martin Fowler
If naming a thing is hard – getting used to a name change is even harder. "PhoneGap" is a recognizable name to most developers that have been involved in (or at least aware of) hybrid mobile application development. "Cordova", on the other hand – what's that? For me, it invokes images of the famous Spanish
You can think of Apache Cordova as the engine that powers PhoneGap, similar to how WebKit is the engine that powers Chrome or Safari….Over time, the PhoneGap distribution may contain additional tools that tie into other Adobe services, which would not be appropriate for an Apache project….PhoneGap will always remain free, open source software and will always be a free distribution of Apache Cordova.
The nice thing about "PhoneGap" is that the name kind of gives away what it does. But not many people would be aware that "Cordova" refers to the street the Nitobi office was on when the PhoneGap project first began. Because of the descriptive aspect of the name "PhoneGap" – as well as the familiarity factor – many people still use it when referring only to the feature set/libraries provided by "Cordova". I liken it to growing up in Atlanta, where every soft drink is a "coke", every tissue a kleenex, and every photocopy a xerox. (It's the Coca-Cola capital of the world, people! You don't want to go to jail, do you?) PhoneGap was "first to market" in getting the name lodged in our brains.
Ok, great - we now know that PhoneGap is a free, open source distribution of Cordova - which is also a free, open source project. But what is Cordova?
It's not just a question newcomers ask. People familiar with it - or at least the idea of it - ask this question, too. Like me, they want to know: What can it do? What can it not do? What sort of trade-offs (especially of the pesky hidden variety) are they making if they opt to build a hybrid mobile app instead of a native one?
For this post - we'll focus on answering the "what is it" question. Given that we're answering what Cordova is, it's safe to assume these answers apply to PhoneGap as well.
The UI of a Cordova application is effectively a 'web view' that takes up the entire screen. According to Andrew Trice:
"The web view used by PhoneGap [same applies to Cordova] is the same web view used by the native operating system. On iOS, this is the Objective-C UIWebView class; on Android, this is android.webkit.WebView. Since there are differences in the web view rendering engines between operating systems, make sure that you account for this in your UI implementation."
Yes – that means what you think it does – you will need to account for differences in DOM implementation between devices. You'd be doing this anyway, if you had been writing a mobile
It's quite common for Cordova apps to follow the "Single Page Application" (SPA) approach. You're not restricted to that, by any means, but it fits the paradigm well.
Your Cordova application gets packaged in the native device install format. For example:
You can see the pattern here - your "web app" assets are packaged into the distributable/install format for the targeted device and are installed like any other application on that device. So - you write a web app, and your user has no idea it's not a native app (usually!).
This list should answer that question. You might be surprised at what's available from each device. For example, an iPhone 3Gs or newer has these APIs exposed:
|Notification - Alert||Notification - Sound||Notification -Vibration||Storage|
Cordova will work with these Operating Systems:
|Symbian||Tizen||webOS||Windows Phone 7|
|Windows Phone 8||Windows 8|
API support for each operating system will vary - so it's best to refer to the supported features chart (this should be applicable for Cordova & PhoneGap) or the platform-specific documentation.
If you're like me you saw this list and raised an eyebrow when you saw "
As mentioned above, Cordova is an Apache Software Foundation project, and is licensed under the Apache License, Version 2.0.
So, let's recap:
Jim Cowart is an architect, developer, open source author, and overall web/hybrid mobile development geek. He is an active speaker and writer, with a passion for elevating developer knowledge of patterns and helpful frameworks.
Subscribe to be the first to get our expert-written articles and tutorials for developers!