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

Creating and saving a new contact


Having an address book or an application that can read contact information from the database is fantastic, but wouldn't it be even better if we could add contacts to the database? The good news is that the PhoneGap API not only provides a way to read the information, but also gives developers an incredibly powerful yet easy way to add information.

Getting ready

For this recipe, we'll build on the code created in the previous recipe, Displaying the contact information of a specific individual. This will give us a head start to add more functionality into the application. Therefore, if you haven't yet completed the previous recipe, Displaying the contact information of a specific individual, it would be a good idea to complete it first.

How to do it...

To store a new contact in the device database, we will create a form and save the new information in a Contact object:

  1. Firstly, let's edit the default loading page for our application to include a button that will...