For the complete documentation index, see llms.txt. This page is also available as Markdown.

Native Contacts API

Access and manage device contacts using the WebToNative JavaScript API. Read, create, and update contacts in Android and iOS apps.

You'll need to import the javascript file in your website before starting from this link.

To Retrive All contacts of device.

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 { getPermissionStatus, getAll } from "webtonative/NativeContacts"

getPermissionStatus({
  callback: function(data){
   //data.status contains permission status
  }
 })
 

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

Feature added in Android on 15/03/24

Last updated