Links

Native Contacts

You'll need to import the javascript file in your website before starting from this link.
To Retrive All contacts of device.
Plain JS
ES 6+
const { contacts } = window.WTN
contacts.getPermissionStatus({
callback: function(data){
//data.status contains permission status
}
})
contacts.getAll({
callback: function(data){
//data.contacts contains all contact
}
})
import contacts from "webtonative/NativeContacts"
contacts.getPermissionStatus({
callback: function(data){
//data.status contains permission status
}
})
contacts.getAll({
callback: function(data){
//data.contacts contains all contact
}
})
the possible status are
  • authorized: Permission has been granted
  • denied: Permission has been denied
  • restricted: access has been administratively prohibited
  • notDetermined: User has not yet been asked for permission
contacts will be an array of contacts with following keys
  • givenName
  • familyName
  • middleName
  • birthday
  • namePrefix
  • previousFamilyName
  • nameSuffix
  • nickname
  • organizationName
  • departmentName
  • jobTitle
  • phoneNumbers* (Array of Objects Described Below)
    • label
    • phoneNumber
  • emailAddresses* (Array of Objects Described Below)
    • label
    • emailAddress
  • postalAddresses* (Array of Objects Described Below)
    • label
    • street
    • subLocality
    • city
    • subAdministrativeArea
    • state
    • postalCode
    • country
    • isoCountryCode