Titanium.Contacts

Submodule of Titanium.
Platform Since
Android 0.8
iPhone 0.8
iPad 0.8

Summary

The top level Contacts module. The Contacts module is used accessing the device Address Book. (Read-only on Android.)

Description

Contacts on Android are currently only read-only, so methods such as createPerson, removePerson, etc., are not supported. Titanium.Contacts.Person objects which have been removed from the database are invalidated after a save operation, whether from creating a new contact or explicitly calling Titanium.Contacts.save(). Using them may result in unpredictable behavior, including crashes.

Objects

Name Summary
Titanium.Contacts.Group

An object which represents a group in the contacts database. (iPhone, iPad only.)

Titanium.Contacts.Person

An object which represents a person in the contacts database.

Methods

Name Summary
addEventListener

Adds the specified callback as an event listener for the named event.

createGroup

create and return an instance of Titanium.Contacts.Group (iPhone, iPad only.)

createPerson

create and return an instance of Titanium.Contacts.Person (iPad, iPhone only.)

fireEvent

Fires a synthesized event to any registered listeners.

getAllGroups

Returns an of all Titanium.Contacts.Group objects in the contacts database (iPad, iPhone only.)

getAllPeople

Returns an array of all Titanium.Contacts.Person objects in the contacts database

getGroupByID

Returns a Titanium.Contacts.Group object with the given ID (iPhone, iPad only.)

getPeopleWithName

Returns an array of Titanium.Contacts.Person objects who have a name (first, last, middle, composite) which matches the given name

getPersonByID

Returns a Titanium.Contacts.Person object with the given ID

removeEventListener

Removes the specified callback as an event listener for the named event.

removeGroup

Removes a group from the contacts database. (iPhone, iPad only.)

removePerson

Removes a person from the contacts database. (iPhone, iPad only.)

revert

Reverts all changes made to the previous save of the database. (iPhone, iPad only.)

save

Saves all changes to contacts to the database.

showContacts

Displays the contact picker

Properties

Name Type Summary
CONTACTS_KIND_ORGANIZATION Number

constant for 'organization' kind property of Person object read-only

CONTACTS_KIND_PERSON Number

constant for 'person' kind property of Person object read-only

CONTACTS_SORT_FIRST_NAME Number

constant for sorting group members by first name read-only

CONTACTS_SORT_LAST_NAME Number

constant for sorting group members by last name read-only

Events

This type has no events.