Using Plugman to Manage Plugins

From version 3.0 onward, Cordova implements all device APIs as plugins, and leaves them disabled by default. It also supports two different ways to add and remove plugins. The first is by using the cordova CLI described in The Command-line Interface. The second is by using a lower-level plugman command-line interface. This guide concentrates on the second approach, which may be useful for developers who want to upgrade their version of Cordova, but who haven't yet adopted the Cordova CLI in their workflow.

For more information on plugman, see the README file in its repository.

Basic Commands

To install plugman, you must have node installed on your machine:

npm install -g plugman

Here is the syntax to add a plugin for each platform:

plugman --platform <ios|android|blackberry10|wp7|wp8> --project <directory> --plugin <name|url|path> [--plugins_dir <directory>] [--www <directory>] [--variable <name>=<value> [--variable <name>=<value> ...]]

To uninstall a plugin:

plugman --uninstall --platform <ios|android|blackberry10|wp7|wp8> --project <directory> --plugin <id> [--www <directory>] [--plugins_dir <directory>]

Installing Core Plugins

The examples below show how to add plugins as needed so that any Cordova APIs you use in your project still work after you upgrade to version 3.0. For each command, you need to select the target platform, and reference the platform's project directory.

  • cordova-plugin-battery-status plugman --platform --project --plugin

  • cordova-plugin-camera plugman --platform --project --plugin

  • cordova-plugin-console plugman --platform --project --plugin

  • cordova-plugin-contacts plugman --platform --project --plugin

  • cordova-plugin-device plugman --platform --project --plugin

  • cordova-plugin-device-motion (accelerometer) plugman --platform --project --plugin

  • cordova-plugin-device-orientation (compass) plugman --platform --project --plugin

  • cordova-plugin-dialogs plugman --platform --project --plugin

  • cordova-plugin-file plugman --platform --project --plugin

  • cordova-plugin-file-transfer plugman --platform --project --plugin

  • cordova-plugin-geolocation plugman --platform --project --plugin

  • cordova-plugin-globalization plugman --platform --project --plugin

  • cordova-plugin-inappbrowser plugman --platform --project --plugin

  • cordova-plugin-media plugman --platform --project --plugin

  • cordova-plugin-media-capture plugman --platform --project --plugin

  • cordova-plugin-network-information plugman --platform --project --plugin

  • cordova-plugin-splashscreen plugman --platform --project --plugin

  • cordova-plugin-vibration plugman --platform --project --plugin