Address Book

This feature allows you to access contact information from the Address Book.

Each contact retrieved can contain First Name, Last Name, User Picture, Email List & Phone Number List.


Check for Authorization Status

This method will let you know if you have the permission to access Address Book.

Make sure you call this method to check for access status and then start on reading contacts.

On iOS platform, this call will show an Alert to let user to give access.

NPBinding.AddressBook.GetAuthorizationStatus();

Read Contacts

This takes a callback which will get triggered once reading contacts is finished.

Callback returns an array of AddressBookContact instances and authorization status.

NPBinding.AddressBook.ReadContacts(OnReceivingContacts);

Sample Callback Implementation

/* Callback method which will be called after reading of contacts is done. */
void OnReceivingContacts(eABAuthorizationStatus _authStatus, AddressBookContact[] _contactList)
{
    if (_authStatus == eABAuthorizationStatus.AUTHORIZED)
    {
        //Start using _contactList here
    }
    else
    {
        Debug.LogError("[AddressBook] " + _authStatus);
    }
}
  • Use GetImageAsync method of AddressBookContact instance to fetch the image asyncronously.
  • If the device contacts are in huge number, it may take a while to get the callback.

eABAuthorizationStatus is an enum which lists different states possible for an address book reading operation.

results matching ""

    No results matching ""