Home > Articles > Home & Office Computing > Entertainment/Gaming/Gadgets

PhoneGap Development, Testing, and Debugging

  • Print
  • + Share This
In this chapter, you’ll analyze the anatomy of a PhoneGap application, identifying what makes an application a PhoneGap application and then highlighting ways to make a PhoneGap application ... better.
This chapter is from the book

As mentioned in the previous chapter, a PhoneGap application can do anything that can be coded in standard, everyday HTML, CSS, and JavaScript. There are web applications and PhoneGap applications, and the distinction between them can be minor or can be considerable. In this chapter, we’ll analyze the anatomy of a PhoneGap application, identifying what makes an application a PhoneGap application and then highlighting ways to make a PhoneGap application ... better.

The following sections will highlight different versions of the requisite Hello-World application found in every developer book, article, and training class. For the purpose of highlighting aspects of the applications’ web content, rather than how they were created, the steps required to create the applications are omitted. Refer to the chapters that follow for specific information on how to create and test PhoneGap projects for each of the supported mobile platforms.

Hello, World!

As with any developer book, we’re going to start with the default HelloWorld application and then build upon it to highlight different aspects of a PhoneGap application. The following HTML content describes a simple web page that displays some text on a page.

HelloWorld1 Application

<!DOCTYPE HTML> 
<html> 
<head> 
  <title>HelloWorld1</title>   
</head> 
<body> 
  <h1>Hello World</h1>   
  <p>This is a sample PhoneGap application</p>   
</body> 
</html>

If you package that page into a PhoneGap application and run it on a smartphone or device emulator (in this case an Android emulator), you will see something similar to what is shown in Figure 2-1.

Figure 2-1

Figure 2-1 HelloWorld1 application running on an Android emulator

This is technically a PhoneGap application because it’s a web application running within the PhoneGap native application container. There is, however, nothing PhoneGap-ish about this application. It’s running in the PhoneGap native container, but it isn’t leveraging any of the APIs provided by the PhoneGap framework.

Therefore, any web application can be built into a PhoneGap application; there’s nothing forcing you to use the PhoneGap APIs. If you have a simple web application that simply needs a way to be deployed through a smartphone app store, then this is one way to accomplish that goal.

  • + Share This
  • 🔖 Save To Your Account