Introduction to Awesome Cordova Plugins

An introduction to Apache Cordova and Awesome Cordova Plugins.

We'll cover the following

Apache Cordova

One of the key selling points of the Ionic framework is its integration with Apache Cordova, allowing mobile and tablet developers to take advantage of its powerful but streamlined plugin API.

Native functionality such as network detection, in-app purchases, and media capture can be accessed and used within Cordova-based apps on a plugin-by-plugin basis simply and quickly thanks to this API.

These plugins expose methods accessible through both JavaScript and TypeScript, which can then be used to interact with the mobile or tablet device for the purposes that the plugin was designed for.

Without this API, our apps would be little more than pre-packaged mobile websites—incredibly limited in scope and not particularly compelling for an end-user to interact with.

When we create an Ionic app (with Cordova integration) using the CLI tool, there are some pre-installed plugins available for immediate use within our apps:

  • Device: provides information about the device hardware and software
  • Status Bar: manages the appearance of the Native Status Bar
  • Splash Screen: helps control the app splash screen loading and display
  • WebView: is a Cordova-based web view specifically for Ionic apps
  • Whitelist: controls access to external website content
  • Ionic Plugin Keyboard: assists with keyboard events and interactions

These are installed in the plugins directory, which is the designated location for all Cordova-based plugins that are to be used within an Ionic app.

If we take a peek inside this directory, we’ll see these plugins are all prefixed with cordova-plugin (which indicates they are Apache Cordova plugins).

These can be installed from a Cordova-based plugin system called Awesome Cordova Plugins, which is what we shall look into throughout this chapter.

Awesome Cordova Plugins

Awesome Cordova Plugins is simply a curated set of Cordova plugins modified to provide wrappers for ES5, ES6, and TypeScript, making them compatible with and available for use in Ionic-based apps.

This is the successor to the previous ngCordova plugin ecosystem that provided Cordova-based plugins with Ionic 1 apps.

Using Awesome Cordova Plugins, we can choose from over 80 plugins that provide anything from background geolocation and access to the device camera to managing phone contacts and working with SQLite databases.

We’ll be working with some of the Awesome Cordova Plugins a little later on in this chapter and throughout the remainder of this course.

Get hands-on with 1200+ tech skills courses.