Interface Contacts

Index

Methods

Methods

public create(properties?: ContactProperties): Contact

The navigator.contacts.create method is synchronous, and returns a new Contact object. This method does not retain the Contact object in the device contacts database, for which you need to invoke the Contact.save method.

Parameters

Returns

Contact

public find(fields: Array<string>, onSuccess: (contacts: Contact[]) => void, onError: (error: ContactError) => void, options?: ContactFindOptions)

The navigator.contacts.find method executes asynchronously, querying the device contacts database and returning an array of Contact objects. The resulting objects are passed to the onSuccess callback function specified by the onSuccess parameter.

Parameters

  • fields: Array<string>

    The fields parameter specifies the fields to be used as a search qualifier, and only those results are passed to the onSuccess callback function. A zero-length fields parameter is invalid and results in ContactError.INVALID_ARGUMENT_ERROR. A contactFields value of "*" returns all contact fields.

  • onSuccess: (contacts: Contact[]) => void

    Success callback function invoked with the array of Contact objects returned from the database

  • onError: (error: ContactError) => void

    Error callback function, invoked when an error occurs.

  • options?: ContactFindOptions optional

    Search options to filter navigator.contacts.