Skip to main content

Contacts

buildfire.device.contacts#

This feature allows the app to access and to get devices contacts.

note

This feature works only on devices; so it will return an error if it was triggered outside devices

Methods#

showDialog()
#

buildfire.device.contacts.showDialog(options, callback)

This function allows you to select one contact, where it shows the contacts in the device via native UI and you can select one of them. It may also ask the user for permission to access the device's contacts if it hasn't previously.

buildfire.device.contacts.showDialog({}, (err, contact) => {
if(err) return console.error(err);
console.log("The Selected Contact", contact);
});

callback(err, data)#

Callback function after selecting a contact

NameTypeDescription
errstringError string, null when operation is successful
dataobjectThe selected contact

search()
#

buildfire.device.contacts.search(options, callback)

This function allows you to select multiple contacts, where you will get all the contacts (in a drawer) from the device and you can select from them. It may also ask the user for permission to access the device's contacts if it hasn't previously.

buildfire.device.contacts.search({}, (err, contacts) => {
if(err) return console.error(err);
console.log("The Selected Contacts", contacts);
});

options#

NameTypeRequiredDescriptionDefault
headerstringnoText or HTML to be rendered as the drawer's header
contentstringnoText or HTML to be rendered in the drawer's body
drawerButtonTextstringnoText of the button'Import'
drawerButtonTypestringnoType of the button (primary, success, info, danger, warning, default)'success'

callback(err, data)#

Callback function after selecting contacts

NameTypeDescription
errstringError string, null when operation is successfull
data[object]Array of the selected contacts

More Examples#

buildfire.device.contacts.search(
{
header: "Contacts",
content: "Select Contacts",
drawerButtonText: "Import Contacts",
drawerButtonType: 'primary'
},
(err, contacts) => {
if(err) return console.error(err);
console.log("The Selected Contacts", contacts);
});