Using Plugins

Plugins let you add functionality to your app which is not available as a web app. There are thousands of Cordova plugins, plus you can add your own.

Plugins are written using native code, so you can access system APIs and features which browsers are locked out of.

The biggest repository of plugins is on npm.

Load from npm

This is the most common way to load plugins into your project. VoltBuilder installs the plugins from npm on each build. The files are not included in your upload, so your zip file stays relatively small.

For each plugin you want to use, add a line like this to your config.xml:

<plugin name="cordova-plugin-device" spec="3.0.0" />

Always give an exact version in spec. Without one, or with a range such as ^3.0.0, each build installs the newest matching release, and a new plugin release can break a build that worked yesterday. Upgrade when you choose to, and test when you do. See Pin your plugin versions.

On the Free plan, only the core plugins are available. On the Indy and Pro plans, any plugin on npm can be used, and spec must be a version number.

Load from a git repository or website

If you’re on an Enterprise Plan, you can bypass npm and load plugins directly from their GitHub repositories.

The repo needs to be public, otherwise VoltBuilder will not be allowed to load.

<plugin name="cordova-plugin-device" spec="https://github.com/apache/cordova-plugin-device.git#2.1.0" />

Note that other HTTP URLs should work too - not just GitHub.

From a local folder

If you’re on an Enterprise Plan, you can put the files for the plugin directly into your project. There are two ways to do this.

In this case, we’re putting the plugin folder at the top level of the project, and telling config.xml where to look for it.

<plugin name="cordova-plugin-device" spec="cordova-plugin-device" />
Project Root
├-- config.xml
├-- certificates
├-- cordova-plugin-device (folder)
├-- voltbuilder.json
└-- www

(tar is also supported - substitute cordova-plugin-device.tar)

From a plugins folder

If you’re on an Enterprise Plan, there is a second way to put the files for the plugin directly into your project.

If you have a plugins folder at the top level, the contents of that will automatically be loaded. There is no need for an entry in config.xml.

Project Root
├-- config.xml
├-- certificates
├-- plugins
│   └-- cordova-plugin-device (folder)
├-- voltbuilder.json
└-- www (required)
Join Our Newsletter
Stay up to date on all of the latest news and updates for VoltBuilder