Apache Cordova 3.2.0
This guide shows you how to create applications and deploy them to various native mobile platforms using the cordova command-line interface (CLI). This tool allows you to create new projects, build them on different platforms, and run on real devices or within emulators.
To install the cordova command-line tool, follow these steps:
- Once install the node js then install the cordova utility. Follow the steps
- goto command line.
- type “sudo npm install -g cordova” (if the node js installation is not occurred in globally then goto the correspondent path. By default on windows, npm can usually be found at “C:\Users\username\AppData\Roaming\npm“ and on Unix at “/usr/local/share/npm“
- “-g” – reference npm to install cordova globally.
- Now the step for creating the app folder. We wish to select the folder.
- Then type the “cordova create hello com.apache.hello HelloWorld
- Where hello is the directory to be generated for the current project. Its “www” subdirectory houses your apploication's home page along with various resources under css, js, and img, which follow common web development file-naming conventions.
- Where com. apache.hello this is optional, which provides your project with a reverse domain-style identifier.
- Where HelloWorld this also optional, which provides the applications display text.
- We can edit com. apache.hello and HelloWorld values later in the config.xml file.
- The config.xml file contains important metadata needed to generate and distributie the applications.
- Enter the hello directory by typing “cd hello” (all subsequent commands need to be run within the project's directory, or any sub directories within its scope.
- Now set the target platform. If our application deployment target is ios then
- “cordova platform add ios” execute this command in command-line.
- “cordova platform add android” for Android target applications.
- Check that your application platform directories add by using “cordova platforms ls”
- note that platform and platforms commands are synonymous
- If we want to remove a platform which was installed then use “cordova platform remove ios” instead of ios you can choose which was installed.
- Once the platform is installed then the 'www' source directory is reproduced within each platform sub directory, appearing for example “platforms/ios/www”. Because the Command line interface constantly copies over files from the source “www” folder, you should noly edit these files and not the ones located under the platform subdirectories. Note if we where using SDK such as Eclipse or Xcode then we have to update the files under the platforms directories. Because the SDK specific metadata files are stored within the appropriate “/platform/” subdirectory.
- Build the Application
- By default the “cordova create” script generates a skeletal web-based application whose homepage is the projects “www/index.html” file. Past our html based application over the folder included the source and assets contents.
- Execute the cordova application from the platform folder.
- Installing new plugin features for getting more interface to native components.
- Step for installing “InAppBrowser”
- Use command line interface to install plugin by
“cordova plugin add org.apache.cordova.inappbrowser”
- These commands apply to all targeted platforms, but modify the platform-specific
Configuration settings described on “config.xml” file
<feature name=”InAppBrowser”>
<param name=”ios-package” value=”CDVInAppBrowser”/>
</feature>
reference
Apache Cordova 3.2.0 documentation link : http://cordova.apache.org/docs/en/3.2.0/index.html
No comments:
Post a Comment