This essay records the installation of the PhoneGap plugin via Plugman.
1th Step: Install Plugman
NPM install-g Plugman
Qiaodemacbook-pro:myapp root#NPM Install- g Plugmannpm WARN engine [email protected]1.3.4: Wanted: {"node":">=0.6","NPM":"1"} (current: {"node":"0.12.2","NPM":"2.7.4"}) npm WARN Installmany normalize-package-data is bundled with [email protected]1.3.4, but the bundled package wasn'T found in unpacked treeNPM WARN engine [email protected]3.9.0: Wanted: {"node":"~0.10.x"} (current: {"node":"0.12.2","NPM":"2.7.4"}) npm WARN engine [email protected]2.2.1: Wanted: {"node":"0.8.x | | 0.10.x"} (current: {"node":"0.12.2","NPM":"2.7.4"})/usr/local/node/bin/plugman-/usr/local/node/lib/node_modules/plugman/Main.js[email protected]0.23.1/usr/local/node/lib/node_modules/Plugman├──[email protected]1.7.0├──[email protected]1.0.1├──[email protected]1.0.9([email protected]1.0.5) ├──[email protected]0.5.2([email protected]0.1.3, [email protected]0.2. One, [email protected]1.1.0, [email protected]0.0.Ten) ├──[email protected]1.3.4([email protected]2.0.0) └──cordova[Email protected]5.0.0([email protected]0.0.1, [email protected]0.1.0, [email protected]0.2.3, [email protected]0.0.6, [email protected]1.2. One, [email protected]1.3.3, [email protected]2.1.0, [email protected]0.3.0, [email protected]1.1.0, [email protected]0.6.7, [email protected]0.1. -, [email protected]0.6.3, [email protected]0.1.5, [email protected]4.0.6, [email protected]3.9.0, [email protected]1.0.2, [email protected]1.1.0, [email protected]1.1.0, [email protected]1.4.2, [email protected]0.4.4, [email protected]2.47.0, [email protected]3.9.0)
2nd Step: Enter the project root directory to download the plugin
qiaodemacbook-pro:desktop root# cd MyAppqiaodemacbook-pro:myapp root#git clone https://github.com/wildabeast/BarcodeScanner.git plugins/com.phonegap.plugins.barcodescannerCloning into'Plugins/com.phonegap.plugins.barcodescanner'... remote:counting objects:1735, Done.remote:Total1735(Delta0), reused0(Delta0), pack-reused1735Receiving objects: -% (1735/1735),3.87MiB |572.00kib/s, done. Resolving deltas: -% (515/515), done. Checking connectivity ... done.
3rd Step: Start the installation
Plugman Install--plugins_dir plugins--plugin com.phonegap.plugins.barcodescanner--platform iOS--project platforms/iOS"com.phonegap.plugins.barcodescanner" for iOS
4th Step: Test
Open index.html, add a link, and increase a click event. The code is as follows:
<aclass="button Addbtn"Id="Barcodescanner">BarcodeScanner</a><script>$("#BarcodeScanner"). Click (function () {Cordova.plugins.barcodeScanner.scan (function (Result) {alert ("scanned Code:"+ Result.text +". Format:"+Result.format+". Cancelled:"+result.cancelled); }, function (Error) {alert ("Scan failed:"+error); }); })</script>
PS: Remember not to introduce PhoneGap JS, otherwise can not call
<script src= "Cordova.js" ></script>
Mac IOS-----PhoneGap Add bar Scan Code Plugin