# Contacts
Access to the contacts list.
# Manifest Declaration
You need to declare the use of this API in the manifest's features
member:
{"name": "system.contact"}
# Module Import
Before using this service in a component, you need to import the module in the script section of the UX document.
import contact from '@system.contact'
Or
let contact = require("@system.contact")
# Methods
This service has the following method:
# pick({success,fail,complete})
Selects a contact.
# Arguments
This method requires an object
with the following attributes:
success
(function(res)
). Optional callback function for success. The function has anobject
as main argument with the following members:res.displayName
(string
) with the name of the contact selected.res.number
(string
) with the phone number of the contact.
fail
(function(code)
). Optional callback function for failure.complete
(function()
). Optional callback function for completion.
Example:
contact.pick({
success: function(data) {
console.log('data : '+data.displayName+', number = '+data.number);
},
fail: function(errmsg, errcode) {
console.log('pick failed ' + errmsg+' errcode = '+errcode);
}
})