getContactList Method

This method returns an array of contact IDs from the local copy of the contact list generated by getContacts

contactListArray = intel.xdk.contacts.getContactList();

Description:

This method returns an array of contact IDs from the local copy of the contact list obtained the last time the getContacts method was called. See the getContacts method for more information.

Available Platforms:

Returns:

contactListArray: An array of contact IDs for the contacts on the device.

Example:


document.addEventListener('intel.xdk.contacts.get', contactsReceived, false);

function contactsReceived() {
        var table = document.getElementById("contacts");
        table.innerHTML = '';

        var myContacts = intel.xdk.contacts.getContactList();

        for(var i=0;i<myContacts.length;i++) {
                //add row to table
                var contactInfo = intel.xdk.contacts.getContactData(myContacts[i]);
                var tr = document.createElement("tr");
                tr.setAttribute('id', 'pnid'+contactInfo.id);
                tr.setAttribute('onClick', 'document.getElementById("iden").value = '+contactInfo.id+';');
                tr.setAttribute('style', 'background-color:#B8BFD8');
                var id = document.createElement("td");
                id.innerHTML = contactInfo.id;
                tr.appendChild(id);
                var msg = document.createElement("td");
                msg.innerHTML = contactInfo.name;
                tr.appendChild(msg);
                table.appendChild(tr);
        }
}
            
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.