Setup Cordovatext Editor/ide
Need to prepare a IDE or Editor for working. Here for example, install a Sublime Text 3-over-Windows, actually it contains versions of Mac OS as well as Linux.
Sublime Text 3
Follow the following sites to install Sublime Test 3 and its plugins.
- Sublime Text 3
- Package Control
After install the package control. Then use the toctrl+shift+popen quick commands. Input and Enter you'llInstall Packagefind your favorate plugins and install with them.
The package Manager can is install in console. The console is accessed via thectrl+\shortcut or theView > Show Console ' menu. Then put the below codes in and enter. Wait One minute ... done!
import urllib.request,os,hashlib; h = ‘7183a2d3e96f11eeadd761d777e62404‘ + ‘e330c659d4bb41d3bdf022e94cab3cd0‘; pf = ‘Package Control.sublime-package‘; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( ‘http://sublime.wbond.net/‘ + pf.replace(‘ ‘, ‘%20‘)).read(); dh = hashlib.sha256(by).hexdigest(); print(‘Error validating download (got %s instead of %s), please try manual install‘ % (dh, h)) if dh != h else open(os.path.join( ipp, pf), ‘wb‘ ).write(by)
Coffeecompile
To configure to connect with coffee script, open in the menu andPreference > Package Setting > CoffeeCompile > Settings - Useredit with:
{
"coffee_path": "C:\\Users\\{{your-windows-user}}\\AppData\\Roaming\\npm\\coffee"
}
The command-line interfaceinstlaling the requrements firstjdk
To download and install JDK. and configure environment as below. I Install JDK inC:\usr\opt\Java\jdk1.7.0_45folder.
set JAVA_HOME=C:\usr\opt\Java\jdk1.7.0_45
set Path=%Path%;%JAVA_HOME%\bin
set classpath=.;%JAVA_HOME%\lib
Android Sdk/adt Bundle
To download and install Android Sdk/adt Bundle. and configure environments as below. I Instlal ADT BundleC:\usr\opt\adt-bundlein, and a Eclipse IDE is prepared for your together with SDK.
set ADT_HOME=C:\usr\opt\adt-bundle
set Path=%Path%;%ADT_HOME%\sdk\platform-tools;%ADT_HOME%\sdk\tools
Ant
To download and install ANT. and configure environment as below. I install Ant inC:\usr\opt\antfolder.
set ANT_HOME=C:\usr\opt\ant
set Path=%Path%;%ANT_HOME%\bin
Installing the Cordova CLI
To install the Cordova command-line tool, follow these steps:
Download and install node. js. Following installation, you should is able to invoke node and NPM on the Your command line. If desired, optionally use a tool such as NVM or nave to manage your node. JS installation.
Download and install a git client, if you don ' t already has one. Following installation, you should is able to invoke git in your command line. Even though you won ' t is using git manually, the CLI does use it behind-the-scenes to download some assets when creating a New project.
Install the Cordova module using NPM Utility of node. js. The Cordova module would automatically is downloaded by the NPM utility.
On Windows:
C:\>npm install-g Cordova
Create the APP
Cordova Create Hello Com.example.hello HelloWorld
ADD platforms
Run any of these from a Windows machine, where WP refers to different versions of the Windows Phone operating system:
$ cordova platform add wp7
$ cordova platform add wp8
$ cordova platform add windows8
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
Run this to check your the current set of platforms:
Cordova Platforms LS
Run either of the following synonymous commands to remove a platform:
$ cordova platform remove blackberry10
$ cordova platform rm amazon-fireos
$ cordova platform rm android
Warning:when using the CLI to build your application, you should not edit any files in the/platforms/directory unless Y ou know what is doing, or if documentation specifies otherwise. The files in this directory is routinely overwritten when preparing applications for building, or when plugins is Reinst Alled.
If you wish at this point, you can use the SDK such as Eclipse or Xcode to open the project you created. You'll need to open the derivative set of assets from the/platforms/directory to develop with an SDK. This was because the SDK specific metadata files is stored within the appropriate/platform/subdirectory. (See the Platform Guides for information on what to develop applications within each IDE.) Use this approach if you simply want to initialize a project using the CLI and then switch to an SDK for native work.
Read on if you wish to use the Cross-platform workflow approach (the CLI) for the entire development cycle.
Build the APP
By default, the Cordova create script generates a skeletal web-based application whose home page is the project ' s Www/inde x.html file. Edit This application however-want, but any initialization should is specified as part of the Deviceready event handle R, referenced by default from Www/js/index.js.
Run the following command to iteratively build the project:
Cordova Build
This generates platform-specific code within the project ' s platforms subdirectory. You can optionally limit the scope of each build to specific platforms:
Cordova Build Android
Test the App on an Emulator or Device
Run a command such as the following to rebuild the app and view it within a specific platform ' s emulator:
Cordova emulate Android
Alternately, you can plug the handset into your computer and test the app directly:
Cordova Run Android
ADD Plugin Features
The Cordova Plugin add command requires you-specify the repository for the plugin code. Here is examples the might use the CLI to add features to the app:
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
Accelerometer, Compass, and geolocation:
$ 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
Access files on device or network (File API):
$ cordova plugin add org.apache.cordova.file
$ cordova plugin add org.apache.cordova.file-transfer
Notification via dialog box or vibration:
$ cordova plugin add org.apache.cordova.dialogs
$ cordova plugin add org.apache.cordova.vibration
Contacts:
Cordova Plugin Add org.apache.cordova.contacts
Globalization:
Cordova Plugin Add org.apache.cordova.globalization
SplashScreen:
Cordova Plugin Add Org.apache.cordova.splashscreen
Open new browser windows (Inappbrowser):
Cordova Plugin Add Org.apache.cordova.inappbrowser
Debug Console:
Cordova Plugin Add Org.apache.cordova.console
Updating Cordova and Your Project
After installingcordovathe utility, your can always update it to the latest version by running the following command:
sudo npm update-g Cordova
Run a command such as the following for each platform you ' re building:
$ cordova platform update android
$ cordova platform update ios
...etc.
See ALSO
Apache Cordova Document