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:
Firstly, let's edit the default loading page for our application to include a button that will...