rmartrenado
rmartrenado

Reputation: 1576

Cordova project configuration: plugin VS gap:plugin

What is the difference between these plugin declarations?

I can't figure out why I have them declared in different ways, however, everything works fine in my project.

<gap:plugin name="org.apache.cordova.device"/>
<gap:plugin name="org.apache.cordova.device-motion"/>
<gap:plugin name="org.apache.cordova.device-orientation"/>
<gap:plugin name="org.apache.cordova.file"/>
<gap:plugin name="org.apache.cordova.file-transfer"/>
<gap:plugin name="org.apache.cordova.geolocation"/>
<gap:plugin name="org.apache.cordova.splashscreen"/>
<gap:plugin name="org.apache.cordova.vibration"/>
<plugin name="cordova-plugin-whitelist" version="1"/>

Also, I'm not sure why I have to add plugins using this command:

cordova plugin add [PLUGIN_ID]

And then keep these references in config.xml.

Thanks a lot!

Upvotes: 2

Views: 1040

Answers (1)

Sjoerd Pottuit
Sjoerd Pottuit

Reputation: 2327

Specify plugins for local environment:

  1. Install cordova plugin(s) with cordova plugin add PLUGIN_NAME.
  2. Enter cordova plugin save in CMD.

When you open your config.xml you will see that your installed plugins are specified there.

For example when I install the plugin 'cordova-plugin-camera' and I enter cordova plugin save in the CMD then the result in the config.xml will be:

<plugin name="cordova-plugin-camera" spec="~1.2.0" />
<!-- ~ = get cordova-plugin-camera version 1.2.0 or higher if available -->

Specify plugins for PhoneGap Build:

  1. Add the plugin specification manually in config.xml.

For example:

<gap:plugin name="cordova-plugin-camera" version="~1.2.0" />

Upvotes: 1

Related Questions