Cordova Learning One: basic Operation __cordova

Source: Internet
Author: User
Official website document: http://docs.phonegap.com/en/edge/guide_overview_index.md.html http://cordova.apache.org/http:// Cordova.apache.org/docs/en/3.4.0/guide_overview_index.md.html#overview
Chinese Document: http://www.phonegapcn.com/
The function support of each system to the plug-in: Http://cordova.apache.org/docs/en/5.0.0/guide_support_index.md.html#Platform%20Support
Cross-platform (CLI) workflow CLI (described in the command-line Interface)
first, the basic Operation Install Cordova:NPM install-g Cordova To create an app:$ Cordova Create Hello Com.example.hello HelloWorld Hello refers to the created app directory name Com.example.hello refers to the domain name identifier, which may have been Config.xml modified HelloWorld refers to the app name that may have been Config.xml modified
Add support Platform(Need to enter directory of current app): $ Cordova Platform Add iOS $ Cordova platform Add Amazon-fireos $ Cordova Platform add Android $ Cordova P Latform Add Blackberry10 $ Cordova Platform Add Firefoxos
$ Cordova Platform Add WP8 $ Cordova Platform Add Windows $ Cordova Platform Add Amazon-fireos $ Cordova Platform Add Andr OID $ Cordova Platform Add BLACKBERRY10 $ Cordova Platform Add Firefoxos
to view the currently supported platforms:$ Cordova Platforms LS
to remove a supported platform:$ Cordova Platform Remove BLACKBERRY10 $ Cordova Platform RM Amazon-fireos $ Cordova Platform RM Android
Build the app:$ Cordova Build build the specified platform app:$ Cordova Build iOS
After running prepare, you can modify the Cordova generated code under the specified platform, and then compile the $ Cordova prepare iOS $ Cordova compile ios</body>
to view the app in the emulator:$ Cordova Emulate Android mobile phone connected to the computer running app:$ Cordova Run Android
Second, Cordova Plug-ins:http://plugins.cordova.io/#/
Find Plug-ins:$ Cordova Plugin Search bar code
Add Plugins:Device Api:basic device information (device API):
$ Cordova Plugin Add Cordova-plugin-device

Network connection, battery management: Network Connection and Battery Events:
$ Cordova Plugin Add cordova-plugin-network-information
$ Cordova Plugin Add Cordova-plugin-battery-status

Acceleration sensors, compass, location: Accelerometer, Compass, and geolocation:
$ Cordova Plugin Add cordova-plugin-device-motion
$ Cordova Plugin Add cordova-plugin-device-orientation
$ Cordova Plugin Add cordova-plugin-geolocation

Camera, media playback and capture: Camera, playback and Capture:
$ Cordova Plugin Add Cordova-plugin-camera
$ Cordova Plugin Add Cordova-plugin-media-capture
$ Cordova Plugin Add Cordova-plugin-media

File access api:access files on device or network (file API):
$ Cordova Plugin Add Cordova-plugin-file
$ Cordova Plugin Add Cordova-plugin-file-transfer

Window (dialog or vibration): Notification via dialog box or vibration:
$ Cordova Plugin Add Cordova-plugin-dialogs
$ Cordova Plugin Add cordova-plugin-vibration

Contacts:
$ Cordova Plugin Add cordova-plugin-contacts

Globalization:
$ Cordova Plugin Add cordova-plugin-globalization

SplashScreen:
$ Cordova Plugin Add Cordova-plugin-splashscreen

Open in Browser: Open new browser windows (Inappbrowser):
$ Cordova Plugin Add Cordova-plugin-inappbrowser

Debug Console: Debug Console:
$ Cordova Plugin Add Cordova-plugin-console
To View added Plug-ins:$ Cordova Plugin ls
To delete a plugin:$ Cordova Plugin RM cordova-plugin-console $ Cordova Plugin Remove Cordova-plugin-console

Bulk Add or remove plug-ins (separated by spaces):$ Cordova Plugin Add Cordova-plugin-console cordova-plugin-device
add specified version number plug-in:$ Cordova Plugin Add Cordova-plugin-console@latest
$ Cordova Plugin Add cordova-plugin-console@0.2.1

plugins added to a code warehouse outside Registry.cordova.io:$ Cordova Plugin Add Https://github.com/apache/cordova-plugin-console.git Specify version number: $ Cordova plugin Add https://github.com /apache/cordova-plugin-console.git#r0.2.0
Specify the directory to add to the Local:$ Cordova Plugin Add Https://github.com/someone/aplugin.git#:/my/sub/dir $ Cordova plugin Add https://github.com/ Someone/aplugin.git#r0.0.1:/my/sub/dir
Specify the local plug-in directory:$ Cordova Plugin Add. /my_plugin_dir
three, different platform of different settingsCreate a new merges directory under the root directory to allow merging and replacing directory rules for different platform subdirectories: Merges/android/www/css/index.css For example: Personalize styles for Android, add < on index.html Link rel= "stylesheet" type= "Text/css" href= "Css/overrides.css"/&gt, create a new empty file under the WWW directory css/ OVERRIDES.CSS (prevents files from being unable to find an error), set up merges/android/www/css/overrides.css to place the style for Android.
Iv. Help$ Cordova Help
$ Cordova
Show help details for the specified command: $ cordova Run--help
$ Cordova Info Displays the currently installed version, Config.xml, plugin information, supported platforms, available simulator versions, etc.
v. Cordova version update Cordova version update:$ NPM update-g Cordova
$ NPM install-g cordova@3.1.0-0.2.0
Displays the details of the update of the Cordova plug-in versions:$ NPM Info Cordova
Update platform information:$ Cordova Platform update Android
$ Cordova Platform Update iOS
migrating from an older version to a new version:1, new Cordova Project after installation, add support platform 2, copy old project's WWW directory to new project 3, old project configuration information in new project Config.xml reset 4, add required plugins in new project
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: