addContact Method

This method accesses the add contact functionality on the device

intel.xdk.contacts.addContact();

Description:

This method displays the native device's contacts application to allow the user to add a new contact. Once a contact is added, it will fire the intel.xdk.contacts.addContact event.

Platforms:

Events:

  • intel.xdk.contacts.add: This event is fired when the new contact has been added to the list, or the operation has been cancelled.
  • intel.xdk.contacts.busy: This event will fire if the contacts.addContact method is called while another process is blocking access to the device's contacts.

Example:


document.addEventListener('intel.xdk.contacts.add', onContactAdded);
                        
intel.xdk.contacts.addContact();

function onChooseContact(evt) {
   if (evt.success == true)
   {
      alert("Contact "+evt.contactid+" successfully added");
   }
   else if (evt.cancelled == true)
   {
      alert("Add Contact Cancelled");
   }
            
Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.