Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To remove an existing contact, an application simply calls the remove method, as shown in the following example:
contact.remove(onContactRemoveSuccess, onContactRemoveError);
The contact object points to an existing contact obtained by creating a new contact via a call to navigator.contacts.create, as described in the beginning of the chapter, or retrieved by searching the local device contacts database using the find method, as described in an earlier section.
The onContactRemoveSuccess and onContactRemoveError parameters passed to the call to remove are callback functions that are executed by the remove method. The onContactRemoveSuccess function is executed after the contact has been successfully removed, while the onContactRemoveError function is the same as the onContactSaveError function described in the first section of this chapter.