I'm a mobile developer who has spent a great deal of time considering this issue.
Why do you ask?
Most likely, you hope to reduce app development costs by:
- Targetting multiple platforms without writing multiple apps from scratch
- Not having to maintain multiple codebases in the future
Reasons may also include:
- Avoiding payment of developer programme registration fees
- Avoiding appstore content restrictions (gambling etc)
- Avoiding purchase of development hardware (e.g. Mac for iPhone development)
Let's establish exactly what we mean by each of the three approaches mentioned:
An app that is installed on a device, usually from its app store (although can sometimes be sideloaded). For the purposes of this discussion, the UI of a native app does not usually consist of a full-screen webview only.
This can in fact be any web page at all, however for this discussion let's consider a single-page web app which attempts to imitate the look and feel of a native app. It is not a native app, it runs in the device's browser.
instanceof native app.
Most people probably understand a hybrid app to be a single-page mobile web app (again most likely imitating the look and feel of a native app), but packaged as a native app with access to native services (à la Phonegap).
However there is in fact a spectrum between the Phonegap model and fully native which I'll come to later.
Let's first list some technical restrictions on mobile web apps which could in themselves be deal-breakers depending on what you're doing:
- HTML/canvas UI only
- No access to certain device events and services (these are widely documented)
- Cannot be listed in app stores (affecting discoverability)
- Can become full screen and have homescreen icon on iOS, however this is an unusual and unfamiliar experience for most users
If you can live with all the above, then read on for more about the challenges of single-page native-style web apps. However this section wouldn't be complete without reference to the FT app.
The FT web app is a famous example of this style of app. Here's an interesting feature from the UK Guardian newspaper about it.
It's certainly a remarkable feat of engineering. Note that it is currently still only available on iOS only -- this tells me that they are finding that resolving the challenges of advanced cross-browser development to be very difficult indeed.
Single-page native-style web apps
This section applies to both mobile web and Phonegap-style apps.
Native-style look and feel within a web app is usually achieved with a framework such as Sencha Touch which provides a suite of UI components for you to use.
Such frameworks are fine for very simple UIs. However they lack flexibility. You won't be able to implement any native app design using Sencha, you'll need to adapt your design to what the framework can accommodate.
Device fragmentation within web browsers is rife, and when you get beyond the most basic HTML and CSS you'll notice things don't quite work as you'd expect. You might find yourself spending more time solving fiddly UI issues than you'd have saved doing it natively twice over. If you're going native, note that native app webviews are not the same as device browsers and have their own fragmentation issues.
That said, it's perfectly possible to create simple, functional apps pretty quickly with this approach. But it's pretty obvious when an app is doing it.
Further along the spectrum
So, we want a better UX than Phonegap-style apps can offer, without writing absolutely everything from scratch multiple times. What can we do?
Share non-UI code
There are a range of techniques available for sharing business logic across multiple native platforms. Google have launched J2ObjC which translates Java into Objective-C. With careful factoring of code, a Java library could be used on both Android and iOS.
Use webviews... where appropriate
Full screen webviews have a lot of work to do to be able to imitate screen transitions and bounce effects. But a webview inside native app chrome can be indistinguishable from native.
There are standard and well documented methods for native apps and webviews to communicate.
Lists and tables can work particularly well when done in this way, however text entry is an example of something best handled natively (for full control over keyboard).
The approach that's right for you depends on how complicated your app is, and what level of UI polish you'll be satisfied with.
My motto: use webviews wherever you can, but make sure your users can't tell.