Address Book
Methods
-
staticQB.addressbook.get(udidOrCallback, callback)
modules/qbAddressBook.js, line 125 -
Retrive all contacts from address book(read more). The method accepts 1 or 2 parameters.
Name Type Description udidOrCallbackstring | function You could pass udid of address book or callback function if you want to get contacts from global address book. callbackfunction optional Callback function is used as 2nd parameter if you pass udid as 1st parameters. This callback takes 2 arguments: an error and a response. Example
var UDID = 'D337E8A4-80AD-8ABA-9F5D-579EFF6BACAB'; function gotContacts(err, contacts) { contacts.forEach( (contact) => { alert(contact); }) } QB.addressbook.get(gotContacts); // or you could specify what address book you need by udid QB.addressbook.get(UDID, gotContacts); -
staticQB.addressbook.getRegisteredUsers(udidOrCallback, callback)
modules/qbAddressBook.js, line 176 -
Retrieve QuickBlox users that have phone numbers from your address book(read more). The methods accepts 1 or 2 parameters.
Name Type Description udidOrCallbackboolean | function You can pass isCompact parameter or callback object. If isCompact is passed then only user's id and phone fields will be returned from server. Otherwise - all standard user's fields will be returned. callbackfunction optional Callback function is useв as 2nd parameter if you pass `isCompact` as 1st parameter. This callback takes 2 arguments: an error and a response. -
staticQB.addressbook.uploadAddressBook(list, options, callback)
modules/qbAddressBook.js, line 58 -
The method is used to create, update and delete contacts in address book.
If contact doesn't exist in address book then it will be created. If contacts exists then it will be updated. If pass 'destroy: 1' then the contact will be removed.
Found more here.
The method accepts 2 or 3 parameters.Name Type Description listArray.<Object> A list of contacts to create / update / delete. optionsObject optional Name Type Description udidstring optional User's device identifier. If specified all operations will be in this context. Max length 64 symbols. If not - it means a user has one global address book across all his devices. forcenumber optional Defines force rewrite mode. If set 1 then all previous contacts for device context will be replaced by new ones. callbackfunction The savedAddressBookCallback function. Example
var people = [{ 'name':'Frederic Cartwright', 'phone': '8879108395' }, { 'phone': '8759108396', 'destroy': 1 }]; var options = { force: 1, udid: 'A337E8A4-80AD-8ABA-9F5D-579EFF6BACAB' }; function addressBookSaved(err, response) { if(err) { } else { console.log('All constacts saved'); } } QB.addressbook.uploadAddressBook(addressBookList, savedAddressBookCallback); // or second parameters can be options QB.addressbook.uploadAddressBook(addressBookList, options, savedAddressBookCallback);