Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PhoneGap By Example

You're reading from   PhoneGap By Example Use PhoneGap to apply web development skills and learn variety of cross-platform mobile applications

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher
ISBN-13 9781785285318
Length 368 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Installing and Configuring PhoneGap FREE CHAPTER 2. Setting Up a Project Structure with Sencha Touch 3. Easy Work with Device – Your First PhoneGap Application "Travelly" 4. Integrating the Travelly Application with Custom Service 5. Crazy Bubbles - Your First HTML5 Mobile Game 6. Share Your Crazy Bubbles Game Result on Social Networks 7. Building a Real-time Communication Application – Pumpidu 8. Building "Imaginary" – An Application with Instagram-like Image Filters 9. Testing the PhoneGap Application 10. Releasing and Maintaining the Application Index

Creating an application

Now, let's create our first application. Let's name it Travelly. It will be just a PhoneGap application scaffolding, and we will continue to develop it in the next chapter. So, to create an application, let's run the following command:

$ cordova create travelly com.cybind.travelly Travelly

We need to wait until this command is executed. The Cordova CLI refers to the external storage to extract all the files needed for the project:

  • The first argument, travelly, is the folder where our project was generated.
  • The second argument, com.cybind.travelly, provides our project with a reverse domain-style identifier. It is an optional argument, if we omit the third argument as well. We can edit this value later in config.xml. However, let's make it right from the beginning so that it is properly configured in the generated code as well. If we do not specify the identifier, it will be defaulted to io.cordova.hellocordova, which we do not want.
  • The third argument, Travelly, provides the application's display title. It is an optional parameter, and the default value is HelloCordova.

Once the command execution is completed, a folder will appear with the following content:

$ ls
config.xml  hooks/     platforms/  plugins/    www/

Where:

  • config.xml: This is the configuration file that contains important metadata needed to generate and distribute the application.
  • hooks/: This is the folder for hooks and pieces of code that Cordova CLI executes at certain points in our Cordova application build.
  • platforms/: This directory is for native code for each of the supported platforms. By default, this is empty, and we need to add the required platforms, which we will see later.
  • plugins/: In this directory, we will place the plugins that provide extra support to the interface with each of the native platforms.
  • www/: This directory houses our application's home page, along with various resources under css, js, and img, which follow common web development file-naming conventions. This gets copied into each of the platform-specific projects in platforms' folder whenever a build is performed. So, this is where our core development will happen and all our cross-platform code will live in.

You can see that all these folders are empty or contain just a basic set of files. The config.xml file contains minimum information. The folder will get full, and config.xml will grow as we continue our development. So, get ready.

You have been reading a chapter from
PhoneGap By Example
Published in: Aug 2015
Publisher:
ISBN-13: 9781785285318
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime