Skip to content

Cordova Plugins

Introduction

Cordova plugins are used to access native device functionality from JavaScript. They are used to access the camera, GPS, file system, etc. They use native code relevant to the platform they are running on. iOS builds interface with Objective-C, Android builds interface with Java.

The plugins folder contains the plugins that are installed. Each plugin is a node package that contains the native code for the plugin, as well as the javascript code for the plugin. The javascript code is used to interface with the native code. The native code is used to interface with the native APIs of the platform.

You can install a plugin by running cordova plugin add <plugin-name>. This will install the plugin in the plugins folder.

Example directory structure of a plugin:

.
├── package.json
├── plugin.xml // plugin configuration file - similar to app config.xml
├── src
│   ├── android
│   │   └── MyPlugin.java // native code for android
│   └── ios
│       └── MyPlugin.m // native objective-c code for ios
└── www
    └── MyPlugin.js // javascript code for plugin that interfaces with native code and exposes plugin to webview

Plugins we use

iOS 🍏 Android 🤖

Plugin NameHandlesAreas UsedPlatform
cordova-plugin-cameraNative cameraInspection photos🍏🤖
cordova-plugin-deviceWorking out current running OS versionAndroid Permissions🤖
cordova-plugin-dialogsRequesting PermissionsAndroid Permissions🤖
cordova-plugin-fileHandling files on device storagePhotos and map downloads🍏🤖
cordova-plugin-geolocationGPSUser Location Tracking🍏🤖
cordova-plugin-network-informationNetwork connection informationWork planning upload🍏🤖
cordova-plugin-ns0m-file-transferUploading files stored on devicePhoto uploads🍏🤖
cordova-plugin-zipUnzipping files stored on deviceMap Downloads🍏🤖
cordova-sqlite-storageStore for app data offline.Interacting with app offline🍏🤖
cordova.plugins.diagnosticRequesting PermissionsAndroid Permissions🤖
cordova-plugin-bluetooth-serialConnecting with bluetooth devicesHigh Accuracy🤖
uk.co.interactive.drains.gnssInterfacing with external GPS devicesHigh Accuracy🤖
uk.co.interactive.drains.gnss-bluetooth-leInterfacing with external GPS devicesHigh Accuracy🤖
uk.co.kaarbontech.ktexternal-sdChecking SD card detailsMap Downloads🤖
cordova-plugin-statusbarNative status bariOS quirk: Stop iOS app being hid behind it🍏
cordova-plugin-wkwebview-file-xhrWeb requests from iOSiOS quirk: Loading online resources like maps🍏