Let’s start with a definition:
noun A mystical collection of machine incantations which grant access to amazing and magical capabilities
Woops! That’s not quite right. However, from the outside, plugins can appear to be almost magical things that are hard to understand. As such, one might shy away from trying to build them, or one might start and get frustrated in the attempt and give up.
But plugins are anything but magical. Here’s a better definition:
noun A module consisting of code and settings extending the essential functionality of Cordova with the goal of providing access to device capabilities, enhancing existing capabilities, or improving the developer’s workflow
Plugins cover a huge swath of the technical landscape. They can do all sorts of things at various times, and chances are they can do more than you may have initially thought.
What can plugins do?
A plugin can do anything that native code could do within the same context. There are various contexts in which a plugin can operate, mainly “install time”, “build time”, and “run time”. Most developers are probably most familiar with the latter context, and most plugins provide their functionality within that context. For example, a plugin that operates in the run time context can use the native SDK’s functionality (including widgets, low-level functionality, etc.), whereas a plugin that operates in either the install or build time context can use Cordova’s Node environment.
Plugins at run time
These plugins have full access to the native SDK and device features. Some examples:
- Push Notifications: PhoneGap, Pushwoosh, AeroGear, OneSignal
- Storage Plugins: Native Storage, SQLite, SQLite 2
- Social Plugins: Email, X SocialSharing
- Audio Plugins: DBMeter, Native Audio, Media Picker
- Misc: Barcode Scanner, In App Purchase, Google Maps, Vuforia (AR), Microsoft ACE (native controls), Tesseract (OCR, iOS)
- Creative Cloud: Auth, Asset Browser, Image Editor, Send to Desktop
Plugins at build time
These plugins have full access to the build-time environment and Cordova project. Some examples:
- Transpile and Bundle ES2015+: Webpack & Transpiler plugin
- Pre-process CSS files (SASS, less, auto-prefixer)
- Check code quality (eslint, tslint, jshint)
Plugins at install time
These plugins have full access to the Cordova project and environment at install time. Some ideas:
- Configure the project environment
- Bundle other plugins
- Provide tests for another plugin…Plugin-ception :fireworks:
Plugin Categories
There are two categories of plugins: core and community. The former are generally plugins that were originally core functionality — that is, they were built-in to Cordova and later split out so that they could be maintained separately and receive updates without having to update all of Cordova. The latter are plugins developed and supported by the community themselves.
There are twenty core plugins:
Plugin | Plugin | Plugin |
---|---|---|
battery-status | camera | console |
contacts | device | device-motion |
device-orientation | dialogs | file |
file-transfer | geolocation | globalization |
inappbrowser | media | media-capture |
network-information | statusbar | |
vibration | whitelist |
Note: A plugin audit is underway. If you want your voice heard regarding core plugins that you use, please see CB-12708, find your core plugin’s issue number, and comment on the plugin’s issue.
There are many, many more community plugins:
Repository | Plugins |
---|---|
https://cordova.apache.org/plugins | ~2,211 plugins & templates (excl. core) |
http://www.plugreg.com | ~1,592 plugins (excl. core) |
http://plugins.telerik.com/cordova | ~77 plugins |
Navigation: