Contacts Application Control – Contact VIEW operation

How to handle contact information (such as phone numbers, email addresses, and Web addresses) in your own application's address book using the device's Contacts application. Contact VIEW operation displays contact information from the device contact database.
var person;
var addressbook = tizen.contact.getDefaultAddressBook();
    			
function contactsFoundCB(contacts) {
    person = contacts[0].personId;

    var itemType = new  tizen.ApplicationControlData("http://tizen.org/appcontrol/data/social/item_type", ["person"]);
    var personId = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/social/item_id", [person]);
    var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/social/view", null, "vnd.tizen.item.type/vnd.tizen.contact", null, [itemType, personId]);

    tizen.application.launchAppControl(appControl, null, 
        function() {
    	     console.log("launch appControl succeeded");
    	  }, function(e) {
    	      /* Error handling */
    	  }, null);
}
    			
var filter = new tizen.AttributeFilter('name.firstName', 'CONTAINS', 'Anna');
try {
    addressbook.find(contactsFoundCB, null, filter, null);
} catch (err) {
    console.log( 'The following error occurred while finding: ' +  err.name);
}

Responses

0 Replies