FeaturedIT topics

Mobile app development after PhoneGap and Cordova

For nearly a decade, PhoneGap has offered web developers a low-friction path for creating mobile apps that have access to native device capabilities. PhoneGap makes it possible for many developers to create apps for iOS and Android (and even Windows Phone and BlackBerry, for a time) using skills and JavaScript libraries they already know and love. This combination of web skills plus native device access (commonly known as “hybrid”) has become firmly rooted as one of the primary approaches to mobile app development.

Now, as work on evolving PhoneGap (and the related Apache Cordova open source project) slows, what’s next for hybrid mobile development?

Obviously, as an open source project, Apache Cordova won’t be going away anytime soon. Many companies have large investments in Cordova, and the Cordova community continues to fill gaps as corporate committers ebb and flow.

But PhoneGap was a project created with the explicit intent to eventually become obsolete, and that moment may be upon us.

Over the course of the last 10 years, two arguably superior options have emerged that are ready to take the place of PhoneGap and “hybrid 1.0.” These are progressive web apps and JavaScript-driven native apps.

Progressive web apps

PhoneGap was always meant to help web developers do more on mobile devices when they hit the limits of mobile web browsers. PhoneGap reuses everything from the web—HTML, CSS, JavaScript—and relies on plugins written in native code (Objective-C, Swift, Java) to access specific native device features via JavaScript. Over time, this has proved to be both a blessing and a curse. The learning curve is very low, but the embedded web browsers in PhoneGap apps often struggle with performance (no thanks to Apple and, for a long while, the default Android web view). Still, PhoneGap was a working solution that produced “good enough” results for many.

Meanwhile, web standards have continued to evolve, and over the last three to four years, the push to improve the web standards necessary for creating higher-performance, offline-ready mobile apps has catalyzed under the term “progressive web apps.”

With progressive web apps, the web platform takes a another giant step forward. Now web apps have full control over the network stack, making it possible to do advanced caching and offline operations. There are also new APIs that help make web apps do other things often associated with native mobile apps, like launching with a splash screen, sending push notifications, or asking users for payment information. Add this to all of the other “HTML5” APIs that have landed in browsers—like access to accelerometers, cameras, etc.—and you have a very capable web platform for many kinds of apps.

All these capabilities would have required a native app when PhoneGap was created, but now the browsers have caught up. We can take off the hybrid training wheels.

Still, there remain limits on the web. It’s just the nature of the slow-moving, standards-based platform. progressive web apps are a giant step forward, but they are not a perfect replacement for all apps. So what are web developers to do after hybrid if they still need full access to native device APIs? Enter JavaScript-driven native apps.

JavaScript-driven native apps

Around five years ago, several companies started to try to find a solution to the frequent performance problems that plagued hybrid mobile apps. The goal: Create frameworks that could deliver “truly native” performance and UI richness while still being cross-platform and familiar to web developers. From this work, two popular options emerged: React Native (from Facebook) and NativeScript (from Progress).

These new frameworks allow developers to continue to reuse their web skills, but instead of simply wrapping a web browser in a native app shell (as PhoneGap does), these new approaches produce a native UI. The result is mobile applications that feel and perform more like “raw” single-platform native apps, while still gaining cross-platform productivity.

There have been a few names to describe this approach: “hybrid 2.0,” “native hybrid,” and “cross-platform native,” among others. Forrester introduced the term “JavaScript-driven native apps,” and while it doesn’t exactly roll off the tongue, it is, at least, an accurate and descriptive name.

With JavaScript-driven native app frameworks, web developers have most of what they loved about PhoneGap, but with even more power and performance. For example, NativeScript, which is deeply integrated with both Angular and Vue, gives developers full access to all native APIs via JavaScript. Every one of them. If it can be done in a native app, it can be done in NativeScript, and cross-platform modules enable most things to be coded once and work on both iOS and Android. It’s like PhoneGap plugins on steroids.

React Native and NativeScript are both thriving open-source projects, and both are ready to be the natural evolution of “hybrid 1.0” for cases where progressive web apps don’t fit the bill.

Which do you choose?

While PhoneGap isn’t gone, it’s hard to imagine why any new project would start with PhoneGap today when options like progressive web apps and JavaScript-driven native apps exist. Both options represent paths built for the future and are relatively trivial to adopt for web developers already familiar with hybrid app development.

Choosing between the options should be simple, too:

  1. If your app doesn’t need a lot of device API access, doesn’t need to be in the app stores, and can live with some extra limits on iOS (for now), build a progressive web app.
  2. If your app’s requirements exceed the limits of progressive web apps, choose one of the JavaScript-driven native app platforms:
    1. If you are a React shop, choose React Native.
    2. If you are an Angular or Vue shop, choose NativeScript. 

Many of the companies that conceive these open-source frameworks are very willing to help, and most offer technical guidance for migrating from PhoneGap to their framework. If you’re looking for a place to start your migration journey, consulting with an expert is always a good idea.

And if you get stuck, or you would just prefer to talk to a third-party expert, there are a number of great resources available for the developer community—the obvious and most popular choice is GitHub. However, there have been many other forums created to help developers migrate from PhoneGap and hybrid to progressive web apps for a while now, and they offer some great pointers.

Ultimately, PhoneGap lived up to its name. It helped web developers span the mobile app development “gap” for nearly a decade. That’s an impressive run by any standard. Now it’s time for progressive web apps and JavaScript-driven native app frameworks to pick-up the mantle and lead developers into the future.

Hybrid (1.0) is dead. Long live hybrid (2.0).

Todd Anglin is vice president of product strategy and developer relations at Progress

New Tech Forum provides a venue to explore and discuss emerging enterprise technology in unprecedented depth and breadth. The selection is subjective, based on our pick of the technologies we believe to be important and of greatest interest to InfoWorld readers. InfoWorld does not accept marketing collateral for publication and reserves the right to edit all contributed content. Send all inquiries to newtechforum@infoworld.com.

Related Articles

Back to top button