Friday 14 November 2014

Create Phonegap application

Here we  are create Phonegap applicton step by step.

1. Install nodejs

To create phonegap app using CLI we need nodejs. We can download node js from nodejs.org. and install  nodejs.
Following installation you should be use node and npm in your command line

2. Install cordova

Install the cordova module using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.
 Open Nodejs commend

C:\>npm install -g cordova

3. Create the App

Go to the directory where you maintain your source code, and run a command such as the following:

cordova create hello com.example.hello HelloWorld



The first argument hello specifies a directory to be generated for your project. This directory should not already exist, Cordova will create it for you. Its www subdirectory houses your application's home page, 



The second argument com.example.hello provides your project with a reverse domain-style identifier. This argument is optional, but only if you also omit the third argument, since the arguments are positional. You can edit this value later in the config.xml file

The third argument HelloWorld provides the application's display title. This argument is optional. You can edit this value later in the config.xml file, but do be aware that there may be code generated outside of config.xml using this value, such as Java class names. 

4. Add Platforms

Before you can build the project, you need to specify a set of target platforms. Your ability to run these commands depends on whether your machine supports each SDK
Go to app folder

   cordova platform add ios
   cordova platform add amazon-fireos
   cordova platform add android
   cordova platform add blackberry10
   cordova platform add firefoxos

Running commands to add or remove platforms affects the contents of the project's platforms directory, where each specified platform appears as a subdirectory.

5. Build the App

By default, the cordova create script generates a skeletal web-based application whose home page is the project's www/index.html file. Edit this application however you want, but any initialization should be specified as part of the deviceready event handler, referenced by default from www/js/index.js.

Run the following command to iteratively build the project:

cordova build

Sorce(Phonegap)

No comments:

Post a Comment