There's no denying that building mobile apps can be a daunting task, especially when it comes to choosing the right framework and tools. In this article, we'll demystify Apache Cordova and explore its capabilities as a powerful tool for swift app development.

Apache Cordova is often referred to as the engine behind PhoneGap, but what exactly does that mean? Essentially, Cordova is a free and open-source project that enables developers to build mobile apps using HTML, JavaScript, and CSS. This approach allows for the creation of hybrid mobile applications that can run on multiple platforms, including iOS, Android, Windows Phone, and more.

One of the key benefits of using Apache Cordova is its ability to provide a consistent JavaScript API across supported devices. This means that developers can write code once and have it work seamlessly on different platforms. Additionally, Cordova provides access to device-specific features such as camera, contacts, file system, geolocation, media, network, notification, and storage.

What Can Cordova Do?

Cordova allows you to write a mobile app using HTML, JavaScript, & CSS - and run it as a native app on the target device. The UI of a Cordova application is effectively a 'web view' that takes up the entire screen, which means you'll need to account for differences in DOM implementation between devices.

Cordova vs. Native Apps

When building a mobile app using Apache Cordova, you're not restricted to following a specific approach. However, it's quite common to follow the "Single Page Application" (SPA) paradigm. This approach fits well with the hybrid nature of Cordova apps.

Packaging and Distribution

Once your Cordova application is complete, it gets packaged in the native device install format. For example, the final build output for iOS is an .ipa file, while for Android, it's an .apk file. 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.

JavaScript Libraries

The JavaScript libraries provided by Cordova give you consistent APIs which you call the same way on any supported device. This is a huge win in that you can leverage existing web development skills to build mobile apps.

Supported Devices and Features

Cordova will work with multiple operating systems, including Android, Bada, Blackberry, iOS, Symbian, Tizen, webOS, Windows Phone 7, Windows Phone 8, and Windows 8. API support for each operating system will vary, so it's best to refer to the supported features chart or platform-specific documentation.

Extensibility

If Cordova doesn't provide a JavaScript API for device functionality that you need, you can write your own native plugin which exposes the native implementation for your JavaScript to access.

Recap

  • Apache Cordova acts as an application container - letting you write a mobile app in HTML/JavaScript/CSS, and packaging it in the target device's installer format.
  • You get a consistent JavaScript API across supported devices.
  • The major mobile device platforms have good support.
  • Cordova is extensible via plugins.
  • Cordova is free & open source.

In our next article, we'll dive deeper into the advantages and disadvantages of choosing a hybrid approach over a native implementation. Stay tuned!