0

PhoneGap – HelloWorld Example via PhoneGap CLI

This post demonstrates how to create a very simple example of PhoneGap application via PhoneGap CLI.

Requirements

Stuffs used in this post.

  • npm 3.10.8
  • node v6.9.1
  • Windows 10
  • PhoneGap 6.5.1

NOTE: The installation of npm and node is not covered here.

Install PhoneGap

  1. Create a new directory, e.g., c:\Users\user123\Desktop\phonegap\example01.
  2. Open Windows command line and change directory to that newly created directory.
  3. From the same command line window, install PhoneGap using npm

  4. Create a PhoneGap application in the same directory

    For example:

    Then, we’re done!

    Don’t close yet the command line window. We’ll get back to it to start our application a bit later.

The PhoneGap Application

The newly created project has these files in its directory.

Let’s now modify the application for it to display “Hello world!”.

Modify index.html

Go to the www folder.

Modify index.html by adding this HTML codes

Testing the PhoneGap Application

From the same command line window, invoke the following command.

Note the IPs addresses. We’ll use one of them to access the PhoneGap application.

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert