Book Image

PhoneGap 4 Mobile Application Development Cookbook

Book Image

PhoneGap 4 Mobile Application Development Cookbook

Overview of this book

Table of Contents (19 chapters)
PhoneGap 4 Mobile Application Development Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

This PhoneGap 4 cookbook is a practical guide to developing hybrid applications using PhoneGap or Cordova. The sample applications here are based on real-world use cases and are shown step by step. This book covers the standard workflow using the Cordova command-line interface, and the extension of hybrid applications using various Cordova plugins. It also covers the development of hybrid applications using the Ionic framework.

What this book covers

Chapter 1, Welcome to PhoneGap 3, focuses on the new language enhancements and command-line features in PhoneGap 3.

Chapter 2, Movement and Location – Using the Accelerometer and Geolocation Sensors, is where we use built-in geolocation and accelerometer sensors. We create a mapping tool using Google Maps to display the phone's location, as well as plotting markers in the surrounding area.

Chapter 3, Filesystems, Storage, and Local Databases, looks into how to access, read, and write to and from the local file storage; list the directory contents to browse the storage; and also how to manage a local SQLite database.

Chapter 4, Working with Audio, Images, and Video, covers working with audio, images, and video, including recording/capturing and playback through local media and remote files.

Chapter 5, Working with Your Contacts List, illustrates how to manage, edit, and deal with contact information on your device.

Chapter 6, Hooking into Native Events, this chapter tells you how to override and manage native events using the PhoneGap library.

Chapter 7, Working with XUI, explains the available methods in the XUI JavaScript library.

Chapter 8, Working with the Ionic Framework, covers playing with the Ionic framework.

Chapter 9, Ionic Framework Development, look into the Ionic framework for layout and style application.

Chapter 10, User Interface Development, shows you the available mobile framework layouts, including jQuery mobile.

Chapter 11, Extending PhoneGap with Plugins, looks into creating a PhoneGap plugin across the main device formats and implementing it in the code.

Chapter 12, Development Tools and Testing, covers the setting up of your development environment and the ways to test your application.

What you need for this book

Node.js is required throughout the book. PhoneGap and the Cordova command-line interface utilize Node.js and NPM. Android Development Tool (ADT) is required if you want to build and emulate PhoneGap applications on Android. To be able to develop for the iOS platform, Xcode is needed. Unlike ADT, which can be run on major operating systems (Windows, Linux, and OS X), Xcode can only be installed on Mac OS X.

Who this book is for

If you are a developer who wants to get started with mobile application development using PhoneGap, then this book is for you. Previous experience of command-line interfaces (the terminal or Command Prompt) will help, but it is not mandatory. A basic understanding of web technologies such as HTML, CSS, and JavaScript is a must.

Sections

In this book, you will find several headings that appear frequently (Getting ready, How to do it…, How it works…, There's more…, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows.

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

"installed_plugins": {
    "org.apache.cordova.network-information": {
        "PACKAGE_NAME": "com.myapp.hello"
    },
    "org.apache.cordova.battery-status": {
        "PACKAGE_NAME": "com.myapp.hello"
    }
},
"dependent_plugins": {}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="rgb.js"></script>
<script type="text/javascript">

Any command-line input or output is written as follows:

sudo npm install -g phonegap

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "If the user selects Yes, they can continue to press the button and see the notification window."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.