First, create the project
// folder name, Boundleid, project name $ cordova Create Hello Com.example.hello HelloWorld
Second, add the platform
// The following commands are all operating under the project folder $ cd Hello // can be used in the MAC environment $ Cordova Platform Add ios$ Cordova Platform add Amazon-fireos$ Cordova Platform add android$ Cordova platfor M add blackberry10$ Cordova Platform Add Firefoxos// Windows environment can use $ Cordova Platform Add wp7$ C Ordova platform Add wp8$ Cordova Platform add windows8$ Cordova Platform add Amazon-fireos$ Cordova Platform Add android$ Cordova Platform Add blackberry10$ Cordova Platform Add Firefoxos
Third, view the current
// View the platform currently being created for the project, and the platform that supports creating the project $ cordova Platforms ls
Iv. Deletion of items
// platform and platforms commands are synonymous $ Cordova Platform Remove blackberry10$ Cordova Platform RM Amazon-fireos$ Cordova Platform RM android
V. Build the project in an iterative manner
$ Cordova Build // Specify Project Platform $ Cordova Build iOS // The following command is the same as the $ Cordova Prepare ios$ Cordova compile iOS
Six, add plug-in function
//1. Search Plugin//Search bar code$ Cordova Plugin Search bar code//find the following pluginCom.phonegap.plugins.barcodescanner-Scans Barcodes//Search bar code$ Cordova Plugin Search bar//find the following pluginOrg.apache.cordova.statusbar-Cordova StatusBar Plugin//2. Add Plugins//Basic device information (device API):$ Cordova Plugin Add Org.apache.cordova.device//network connection and battery events:$ Cordova Plugin Add org.apache.cordova.network-information$ Cordova Plugin Add org.apache.cordova.battery-Status//accelerometers, compasses, and geo-positioning:$ Cordova Plugin Add org.apache.cordova.device-motion$ Cordova Plugin Add Org.apache.cordova.device-orientation$ Cordova Plugin Add org.apache.cordova.geolocation//camera, media playback, and capture:$ Cordova Plugin Add org.apache.cordova.camera$ Cordova plugin add Org.apache.cordova.media-capture$ Cordova Plugin Add Org.apache.cordova.media//to access files on a device or network (file API):$ Cordova Plugin Add org.apache.cordova.file$ Cordova plugin add org.apache.cordova.file-Transfer//To make a notification through a dialog box or vibrate:$ Cordova Plugin Add org.apache.cordova.dialogs$ Cordova plugin add org.apache.cordova.vibration//Contact:$ Cordova Plugin Add org.apache.cordova.contacts//Globalization:$ Cordova Plugin Add org.apache.cordova.globalization//splash Screen:$ Cordova Plugin Add Org.apache.cordova.splashscreen//Open a new browser window (inappbrowser):$ Cordova Plugin Add Org.apache.cordova.inappbrowser//Debug Console:$ Cordova Plugin Add Org.apache.cordova.console
Vii. Deleting plugins
// 1. Use plugin ls (or plugin list, or plugin itself) to view the currently installed plugins. Each display is represented by its identifier: $ cordova plugin ls 'plugin list'// 2, to remove a plug-in. $ Cordova Plugin RM org.apache.cordova.device $ Cordova Plugin Remove org.apache.cordova.device< /c11>// 3, you can bulk delete or add a plugin by specifying multiple parameters for each command: $ Cordova Plugin Add Org.apache.cordova.console Org.apache.cordova.device
Eight, advanced plug-in options
//1. Specify the version number after @, latest represents the latest version. $ Cordova Plugin Add [email protected] $ Cordova plugin Add [email protected]0.2.1//2. Git repository address$ Cordova Plugin Add https://Github.com/apache/cordova-plugin-console.git//3. Git branch$ Cordova Plugin Add https://github.com/apache/cordova-plugin-console.git#r0.2.0//4. Git sub-directory$ Cordova Plugin Add https://Github.com/someone/aplugin.git#:/my/sub/dir//5. Git branch subdirectory$ Cordova Plugin Add https://Github.com/someone/aplugin.git#r0.0.1:/my/sub/dir//6. Specify a local path that contains the plug-in plugin.xml file:$ Cordova Plugin Add: /my_plugin_dir
Nine, help
//1. Help with related commands$ Cordova Help $ Cordova $ Cordova Info//Note: Currently, detailed information is available only on IOS and Android platforms. //2. Update Cordova to the latest version by running the following command:$ sudo npm update-G Cordova//3. Use this syntax to install a specific version:$ sudo npm install-g [email protected]3.1.0-0.2.0//4. Run cordova-v to view the currently running version. Run the NPM Info command to view the current version and other available version numbers:$ npm Info Cordova//5. Ensure that your project resources meet the latest version requirements:$ Cordova Platform update Android $ Cordova Platform update iOS ... etc.
References and acknowledgements: Http://docs.phonegap.com/zh/edge/guide_cli_index.md.html#%E5%91%BD%E4%BB%A4%E8%A1%8C%E7%95%8C%E9%9D%A2
Http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface
Common directives for C2 and PHONEGAP projects