{"id":15096102,"url":"https://github.com/apache/cordova-plugin-contacts","last_synced_at":"2025-10-08T00:31:47.872Z","repository":{"id":9085295,"uuid":"10860593","full_name":"apache/cordova-plugin-contacts","owner":"apache","description":"[DEPRECATED] Apache Cordova Plugin contacts","archived":true,"fork":false,"pushed_at":"2022-11-29T08:28:57.000Z","size":912,"stargazers_count":210,"open_issues_count":0,"forks_count":373,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-01-20T12:02:34.549Z","etag":null,"topics":["cordova","cplusplus","csharp","java","javascript","library","mobile","nodejs","objective-c"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-22T07:00:14.000Z","updated_at":"2024-11-01T23:46:00.000Z","dependencies_parsed_at":"2022-08-21T03:20:55.915Z","dependency_job_id":null,"html_url":"https://github.com/apache/cordova-plugin-contacts","commit_stats":null,"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-contacts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-contacts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-contacts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-contacts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/cordova-plugin-contacts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235669382,"owners_count":19026815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova","cplusplus","csharp","java","javascript","library","mobile","nodejs","objective-c"],"created_at":"2024-09-25T15:45:30.408Z","updated_at":"2025-10-08T00:31:42.545Z","avatar_url":"https://github.com/apache.png","language":"JavaScript","readme":"---\ntitle: Contacts\ndescription: Manage the contacts on the device.\n---\n\u003c!---\n# license: Licensed to the Apache Software Foundation (ASF) under one\n#         or more contributor license agreements.  See the NOTICE file\n#         distributed with this work for additional information\n#         regarding copyright ownership.  The ASF licenses this file\n#         to you under the Apache License, Version 2.0 (the\n#         \"License\"); you may not use this file except in compliance\n#         with the License.  You may obtain a copy of the License at\n#\n#           http://www.apache.org/licenses/LICENSE-2.0\n#\n#         Unless required by applicable law or agreed to in writing,\n#         software distributed under the License is distributed on an\n#         \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#         KIND, either express or implied.  See the License for the\n#         specific language governing permissions and limitations\n#         under the License.\n--\u003e\n\n|AppVeyor|Travis CI|\n|:-:|:-:|\n|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-contacts?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-contacts)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-contacts.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-contacts)|\n\n# cordova-plugin-contacts\n\nThis plugin defines a global `navigator.contacts` object, which provides access to the device contacts database.\n\nAlthough the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.\n```js\ndocument.addEventListener(\"deviceready\", onDeviceReady, false);\nfunction onDeviceReady() {\nconsole.log(navigator.contacts);\n}\n```\n\n---\n\n⚠️ __WARNING__: Collection and use of contact data raises\nimportant privacy issues.  Your app's privacy policy should discuss\nhow the app uses contact data and whether it is shared with any other\nparties.  \nContact information is considered sensitive because it\nreveals the people with whom a person communicates.  Therefore, in\naddition to the app's privacy policy, you should strongly consider\nproviding a just-in-time notice before the app accesses or uses\ncontact data, if the device operating system doesn't do so\nalready. That notice should provide the same information noted above,\nas well as obtaining the user's permission (e.g., by presenting\nchoices for __OK__ and __No Thanks__).  \nNote that some app\nmarketplaces may require the app to provide a just-in-time notice and\nobtain the user's permission before accessing contact data.  A\nclear and easy-to-understand user experience surrounding the use of\ncontact data helps avoid user confusion and perceived misuse of\ncontact data.  \nFor more information, please see the [Privacy Guide](http://cordova.apache.org/docs/en/latest/guide/appdev/privacy/index.html).\n\n--- \n\n## Deprecation Notice\n\nThis plugin is being deprecated. No more work will be done on this plugin by the Cordova development community. You can continue to use this plugin and it should work as-is in the future but any more arising issues will not be fixed by the Cordova community.\n\n--- \n\n## Installation\n\n    cordova plugin add cordova-plugin-contacts\n    \nOlder versions of cordova can still install via the __deprecated__ id (stale v0.2.16)\n\n    cordova plugin add org.apache.cordova.contacts\n    \nIt is also possible to install via repo url directly (unstable)\n\n    cordova plugin add https://github.com/apache/cordova-plugin-contacts.git\n\n\n### iOS Quirks\n\nSince iOS 10 it's mandatory to provide an usage description in the `info.plist` if trying to access privacy-sensitive data. When the system prompts the user to allow access, this usage description string will displayed as part of the permission dialog box, but if you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.\n\n This plugins requires the following usage description:\n\n * `NSContactsUsageDescription` describes the reason that the app accesses the user's contacts.\n\n To add this entry into the `info.plist`, you can use the `edit-config` tag in the `config.xml` like this:\n\n```\n\u003cedit-config target=\"NSContactsUsageDescription\" file=\"*-Info.plist\" mode=\"merge\"\u003e\n    \u003cstring\u003eneed contacts access to search friends\u003c/string\u003e\n\u003c/edit-config\u003e\n```\n\n### Windows Quirks\n\n**Prior to Windows 10:** Any contacts returned from `find` and `pickContact` methods are readonly, so your application cannot modify them.\n`find` method available only on Windows Phone 8.1 devices.\n\n**Windows 10 and above:** Contacts may be saved and will be saved to app-local contacts storage.  Contacts may also be deleted.\n\n\n\u003cdetails\u003e\n\t\u003csummary\u003edeprecated platforms\u003c/summary\u003e\n\t\n### Firefox OS Quirks\n\nCreate __www/manifest.webapp__ as described in\n[Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest).\nAdd relevant permisions.\nThere is also a need to change the webapp type to \"privileged\"  - [Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest#type).\n__WARNING__: All privileged apps enforce [Content Security Policy](https://developer.mozilla.org/en-US/Apps/CSP) which forbids inline script. Initialize your application in another way.\n\n```json\n\"type\": \"privileged\",\n\"permissions\": {\n\t\"contacts\": {\n\t\t\"access\": \"readwrite\",\n\t\t\"description\": \"Describe why there is a need for such permission\"\n\t}\n}\n```\n\n### Windows 8 Quirks\n\nWindows 8 Contacts are readonly. Via the Cordova API Contacts are not queryable/searchable, you should inform the user to pick a contact as a call to contacts.pickContact which will open the 'People' app where the user must choose a contact.\nAny contacts returned are readonly, so your application cannot modify them.\n\u003c/details\u003e\n\n## navigator.contacts\n\n### Methods\n\n- navigator.contacts.create\n- navigator.contacts.find\n- navigator.contacts.pickContact\n\n### Objects\n\n- Contact\n- ContactName\n- ContactField\n- ContactAddress\n- ContactOrganization\n- ContactFindOptions\n- ContactError\n- ContactFieldType\n\n## navigator.contacts.create\n\nThe `navigator.contacts.create` method is synchronous, and returns a new `Contact` object.\n\nThis method does not retain the Contact object in the device contacts\ndatabase, for which you need to invoke the `Contact.save` method.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n\n### Example\n\n```js\n    var myContact = navigator.contacts.create({\"displayName\": \"Test User\"});\n```\n\n## navigator.contacts.find\n\nThe `navigator.contacts.find` method executes asynchronously, querying the\ndevice contacts database and returning an array of `Contact` objects.\nThe resulting objects are passed to the `contactSuccess` callback\nfunction specified by the __contactSuccess__ parameter.\n\nThe __contactFields__ parameter should always be an array and specifies the\nfields to be used as a search qualifier.  A zero-length __contactFields__\nparameter is invalid and results in `ContactError.INVALID_ARGUMENT_ERROR`.\nA __contactFields__ value of `[\"*\"]` searches all contact fields.\n\nThe __contactFindOptions.filter__ string can be used as a search\nfilter when querying the contacts database.  If provided, a\ncase-insensitive, partial value match is applied to each field\nspecified in the __contactFields__ parameter.  If there's a match for\n_any_ of the specified fields, the contact is returned. Use __contactFindOptions.desiredFields__\nparameter to control which contact properties must be returned back.\n\nSupported values for both __contactFields__ and __contactFindOptions.desiredFields__ parameters are enumerated in [`ContactFieldType`](#contactfieldtype) object.\n\n### Parameters\n\n- __contactFields__: Contact fields to use as a search qualifier. _(DOMString[])_ [Required]\n\n- __contactSuccess__: Success callback function invoked with the array of Contact objects returned from the database. [Required]\n\n- __contactError__: Error callback function, invoked when an error occurs. [Optional]\n\n- __contactFindOptions__: Search options to filter navigator.contacts. [Optional]\n\n\tKeys include:\n\n\t- __filter__: The search string used to find navigator.contacts. _(DOMString)_ (Default: `\"\"`)\n\n\t- __multiple__: Determines if the find operation returns multiple navigator.contacts. _(Boolean)_ (Default: `false`)\n\n    - __desiredFields__: Contact fields to be returned back. If specified, the resulting `Contact` object only features values for these fields. _(DOMString[])_ [Optional]\n\n    - __hasPhoneNumber__(Android only): Filters the search to only return contacts with a phone number informed. _(Boolean)_ (Default: `false`)\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows (Windows Phone 8.1 and Windows 10)\n- BlackBerry 10\n- Firefox OS\n- Windows Phone 8\n\n### Example\n\n```js\nfunction onSuccess(contacts) {\n\talert('Found ' + contacts.length + ' contacts.');\n};\n\nfunction onError(contactError) {\n\talert('onError!');\n};\n\n// find all contacts with 'Bob' in any name field\nvar options      = new ContactFindOptions();\noptions.filter   = \"Bob\";\noptions.multiple = true;\noptions.desiredFields = [navigator.contacts.fieldType.id];\noptions.hasPhoneNumber = true;\nvar fields       = [navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name];\nnavigator.contacts.find(fields, onSuccess, onError, options);\n```\n\n### Windows Quirks\n\n- `contactFields` is not supported and will be ignored. `find` method will always attempt to match the name, email address, or phone number of a contact.\n\n## navigator.contacts.pickContact\n\nThe `navigator.contacts.pickContact` method launches the Contact Picker to select a single contact.\nThe resulting object is passed to the `contactSuccess` callback\nfunction specified by the __contactSuccess__ parameter.\n\n### Parameters\n\n- __contactSuccess__: Success callback function invoked with the single Contact object. [Required]\n\n- __contactError__: Error callback function, invoked when an error occurs. [Optional]\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows\n- Windows Phone 8\n\n### Example\n\n```js\nnavigator.contacts.pickContact(function(contact){\n        console.log('The following contact has been selected:' + JSON.stringify(contact));\n    },function(err){\n        console.log('Error: ' + err);\n    });\n```\n\n### Android Quirks\n\nThis plugin launches an external Activity for picking contacts. See the\n[Android Lifecycle Guide](http://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#lifecycle-guide)\nfor an explanation of how this affects your application. If the plugin returns\nits result in the `resume` event, then you must first wrap the returned object\nin a `Contact` object before using it. Here is an example:\n\n```javascript\nfunction onResume(resumeEvent) {\n    if(resumeEvent.pendingResult) {\n        if(resumeEvent.pendingResult.pluginStatus === \"OK\") {\n            var contact = navigator.contacts.create(resumeEvent.pendingResult.result);\n            successCallback(contact);\n        } else {\n            failCallback(resumeEvent.pendingResult.result);\n        }\n    }\n}\n```\n\n## Contact\n\nThe `Contact` object represents a user's contact.  Contacts can be\ncreated, stored, or removed from the device contacts database.\nContacts can also be retrieved (individually or in bulk) from the\ndatabase by invoking the `navigator.contacts.find` method.\n\n__NOTE__: Not all of the contact fields listed above are supported on\nevery device platform.  Please check each platform's _Quirks_ section\nfor details.\n\n\n### Properties\n\n- __id__: A globally unique identifier. _(DOMString)_\n\n- __displayName__: The name of this Contact, suitable for display to end users. _(DOMString)_\n\n- __name__: An object containing all components of a persons name. _(ContactName)_\n\n- __nickname__: A casual name by which to address the contact. _(DOMString)_\n\n- __phoneNumbers__: An array of all the contact's phone numbers. _(ContactField[])_\n\n- __emails__: An array of all the contact's email addresses. _(ContactField[])_\n\n- __addresses__: An array of all the contact's addresses. _(ContactAddress[])_\n\n- __ims__: An array of all the contact's IM addresses. _(ContactField[])_\n\n- __organizations__: An array of all the contact's organizations. _(ContactOrganization[])_\n\n- __birthday__: The birthday of the contact. _(Date)_\n\n- __note__: A note about the contact. _(DOMString)_\n\n- __photos__: An array of the contact's photos. _(ContactField[])_\n\n- __categories__:  An array of all the user-defined categories associated with the contact. _(ContactField[])_\n\n- __urls__:  An array of web pages associated with the contact. _(ContactField[])_\n\n### Methods\n\n- __clone__: Returns a new `Contact` object that is a deep copy of the calling object, with the `id` property set to `null`.\n\n- __remove__: Removes the contact from the device contacts database, otherwise executes an error callback with a `ContactError` object.\n\n- __save__: Saves a new contact to the device contacts database, or updates an existing contact if a contact with the same __id__ already exists.\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows\n- BlackBerry 10\n- Firefox OS\n- Amazon Fire OS\n- Windows Phone 8\n\n\n### Save Example\n\n```js\nfunction onSuccess(contact) {\n    alert(\"Save Success\");\n};\n\nfunction onError(contactError) {\n    alert(\"Error = \" + contactError.code);\n};\n\n// create a new contact object\nvar contact = navigator.contacts.create();\ncontact.displayName = \"Plumber\";\ncontact.nickname = \"Plumber\";            // specify both to support all devices\n\n// populate some fields\nvar name = new ContactName();\nname.givenName = \"Jane\";\nname.familyName = \"Doe\";\ncontact.name = name;\n\n// save to device\ncontact.save(onSuccess,onError);\n```\n\n### Clone Example\n\n```js\n// clone the contact object\nvar clone = contact.clone();\nclone.name.givenName = \"John\";\nconsole.log(\"Original contact name = \" + contact.name.givenName);\nconsole.log(\"Cloned contact name = \" + clone.name.givenName);\n```\n\n### Remove Example\n\n```js\nfunction onSuccess() {\n    alert(\"Removal Success\");\n};\n\nfunction onError(contactError) {\n    alert(\"Error = \" + contactError.code);\n};\n\n// remove the contact from the device\ncontact.remove(onSuccess,onError);\n```\n### Removing phone number(s) from a saved contact\n\n```js\n// Example to create a contact with 3 phone numbers and then remove\n// 2 phone numbers. This example is for illustrative purpose only\nvar myContact = navigator.contacts.create({\"displayName\": \"Test User\"});\nvar phoneNumbers = [];\n\nphoneNumbers[0] = new ContactField('work', '768-555-1234', false);\nphoneNumbers[1] = new ContactField('mobile', '999-555-5432', true); // preferred number\nphoneNumbers[2] = new ContactField('home', '203-555-7890', false);\n\nmyContact.phoneNumbers = phoneNumbers;\nmyContact.save(function (contact_obj) {\n    var contactObjToModify = contact_obj.clone();\n    contact_obj.remove(function(){\n        var phoneNumbers = [contactObjToModify.phoneNumbers[0]];\n        contactObjToModify.phoneNumbers = phoneNumbers;\n        contactObjToModify.save(function(c_obj){\n            console.log(\"All Done\");\n        }, function(error){\n            console.log(\"Not able to save the cloned object: \" + error);\n        });\n    }, function(contactError) {\n        console.log(\"Contact Remove Operation failed: \" + contactError);\n    });\n});\n```\n\n### iOS Quirks\n\n- __displayName__: Not supported on iOS, returning `null` unless there is no `ContactName` specified, in which case it returns the composite name, __nickname__ or `\"\"`, respectively.\n\n- __birthday__: Must be input as a JavaScript `Date` object, the same way it is returned.\n\n- __photos__: Returns a File URL to the image, which is stored in the application's temporary directory.  Contents of the temporary directory are removed when the application exits.\n\n- __categories__:  This property is currently not supported, returning `null`.\n\n### Android 2.X Quirks\n\n- __categories__:  Not supported on Android 2.X devices, returning `null`.\n\n### Windows Quirks\n\n- __photos__: Returns a File URL to the image, which is stored in the application's temporary directory.\n\n- __birthdays__: Not supported, returning `null`.\n\n- __categories__: Not supported, returning `null`.\n\n- __remove__: Method is only supported in Windows 10 or above.\n\n\n\u003cdetails\u003e\n\t\u003csummary\u003edeprecated platforms\u003c/summary\u003e\n\n### BlackBerry 10 Quirks\n\n- __id__: Assigned by the device when saving the contact.\n\n### FirefoxOS Quirks\n\n- __categories__: Partially supported. Fields __pref__ and __type__ are returning `null`\n\n- __ims__: Not supported\n\n- __photos__: Not supported\n\n### Windows Phone 8 Quirks\n\n- __displayName__: When creating a contact, the value provided for the display name parameter differs from the display name retrieved when finding the contact.\n\n- __urls__: When creating a contact, users can input and save more than one web address, but only one is available when searching the contact.\n\n- __phoneNumbers__: The _pref_ option is not supported. The _type_ is not supported in a _find_ operation. Only one `phoneNumber` is allowed for each _type_.\n\n- __emails__: The _pref_ option is not supported. Home and personal references same email entry. Only one entry is allowed for each _type_.\n\n- __addresses__: Supports only work, and home/personal _type_. The home and personal _type_ reference the same address entry. Only one entry is allowed for each _type_.\n\n- __organizations__: Only one is allowed, and does not support the _pref_, _type_, and _department_ attributes.\n\n- __note__: Not supported, returning `null`.\n\n- __ims__: Not supported, returning `null`.\n\n- __birthdays__: Not supported, returning `null`.\n\n- __categories__: Not supported, returning `null`.\n\n- __remove__: Method is not supported\n\n\u003c/details\u003e\n\n\n## ContactAddress\n\nThe `ContactAddress` object stores the properties of a single address\nof a contact.  A `Contact` object may include more than one address in\na `ContactAddress[]` array.\n\n\n### Properties\n\n- __pref__: Set to `true` if this `ContactAddress` contains the user's preferred value. _(boolean)_\n\n- __type__: A string indicating what type of field this is, _home_ for example. _(DOMString)_\n\n- __formatted__: The full address formatted for display. _(DOMString)_\n\n- __streetAddress__: The full street address. _(DOMString)_\n\n- __locality__: The city or locality. _(DOMString)_\n\n- __region__: The state or region. _(DOMString)_\n\n- __postalCode__: The zip code or postal code. _(DOMString)_\n\n- __country__: The country name. _(DOMString)_\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows\n- Amazon Fire OS\n- BlackBerry 10\n- Firefox OS\n- Windows Phone 8\n\n\n### Example\n\n```js\n// display the address information for all contacts\n\nfunction onSuccess(contacts) {\n    for (var i = 0; i \u003c contacts.length; i++) {\n        for (var j = 0; j \u003c contacts[i].addresses.length; j++) {\n            alert(\"Pref: \"         + contacts[i].addresses[j].pref          + \"\\n\" +\n                \"Type: \"           + contacts[i].addresses[j].type          + \"\\n\" +\n                \"Formatted: \"      + contacts[i].addresses[j].formatted     + \"\\n\" +\n                \"Street Address: \" + contacts[i].addresses[j].streetAddress + \"\\n\" +\n                \"Locality: \"       + contacts[i].addresses[j].locality      + \"\\n\" +\n                \"Region: \"         + contacts[i].addresses[j].region        + \"\\n\" +\n                \"Postal Code: \"    + contacts[i].addresses[j].postalCode    + \"\\n\" +\n                \"Country: \"        + contacts[i].addresses[j].country);\n        }\n    }\n};\n\nfunction onError(contactError) {\n    alert('onError!');\n};\n\n// find all contacts\nvar options = new ContactFindOptions();\noptions.filter = \"\";\noptions.multiple = true;\nvar filter = [\"displayName\", \"addresses\"];\nnavigator.contacts.find(filter, onSuccess, onError, options);\n```\n\n### iOS Quirks\n\n- __pref__: Not supported on iOS devices, returning `false`.\n\n- __formatted__: Currently not supported.\n\n### Windows Quirks\n\n- __pref__: Not supported\n\n### Android 2.X Quirks\n\n- __pref__: Not supported, returning `false` on Android 2.X devices.\n\n\n\u003cdetails\u003e\n\t\u003csummary\u003edeprecated platforms\u003c/summary\u003e\n\n### BlackBerry 10 Quirks\n\n- __pref__: Not supported on BlackBerry devices, returning `false`.\n\n- __type__: Partially supported.  Only one each of _Work_ and _Home_ type addresses can be stored per contact.\n\n- __formatted__: Partially supported.  Returns a concatenation of all BlackBerry address fields.\n\n- __streetAddress__: Supported.  Returns a concatenation of BlackBerry __address1__ and __address2__ address fields.\n\n- __locality__: Supported.  Stored in BlackBerry __city__ address field.\n\n- __region__: Supported.  Stored in BlackBerry __stateProvince__ address field.\n\n- __postalCode__: Supported.  Stored in BlackBerry __zipPostal__ address field.\n\n- __country__: Supported.\n\n### FirefoxOS Quirks\n\n- __formatted__: Currently not supported\n\n\u003c/details\u003e\n\n\n## ContactError\n\nThe `ContactError` object is returned to the user through the\n`contactError` callback function when an error occurs.\n\n### Properties\n\n- __code__: One of the predefined error codes listed below.\n\n### Constants\n\n- `ContactError.UNKNOWN_ERROR` (code 0)\n- `ContactError.INVALID_ARGUMENT_ERROR` (code 1)\n- `ContactError.TIMEOUT_ERROR` (code 2)\n- `ContactError.PENDING_OPERATION_ERROR` (code 3)\n- `ContactError.IO_ERROR` (code 4)\n- `ContactError.NOT_SUPPORTED_ERROR` (code 5)\n- `ContactError.OPERATION_CANCELLED_ERROR` (code 6)\n- `ContactError.PERMISSION_DENIED_ERROR` (code 20)\n\n\n## ContactField\n\nThe `ContactField` object is a reusable component that represents\ncontact fields generically.  Each `ContactField` object contains a\n`value`, `type`, and `pref` property.  A `Contact` object stores\nseveral properties in `ContactField[]` arrays, such as phone numbers\nand email addresses.\n\nIn most instances, there are no pre-determined values for a\n`ContactField` object's __type__ attribute.  For example, a phone\nnumber can specify __type__ values of _home_, _work_, _mobile_,\n_iPhone_, or any other value that is supported by a particular device\nplatform's contact database.  However, for the `Contact` __photos__\nfield, the __type__ field indicates the format of the returned image:\n__url__ when the __value__ attribute contains a URL to the photo\nimage, or _base64_ when the __value__ contains a base64-encoded image\nstring.\n\n### Properties\n\n- __type__: A string that indicates what type of field this is, _home_ for example. _(DOMString)_\n\n- __value__: The value of the field, such as a phone number or email address. _(DOMString)_\n\n- __pref__: Set to `true` if this `ContactField` contains the user's preferred value. _(boolean)_\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows\n- BlackBerry 10\n- Firefox OS\n- Amazon Fire OS\n- Windows Phone 8\n\n\n### Example\n\n```js\n// create a new contact\nvar contact = navigator.contacts.create();\n\n// store contact phone numbers in ContactField[]\nvar phoneNumbers = [];\nphoneNumbers[0] = new ContactField('work', '212-555-1234', false);\nphoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // preferred number\nphoneNumbers[2] = new ContactField('home', '203-555-7890', false);\ncontact.phoneNumbers = phoneNumbers;\n\n// save the contact\ncontact.save();\n```\n\n### iOS Quirks\n\n- __pref__: Not supported, returning `false`.\n\n### Windows Quirks\n\n- __pref__: Not supported, returning `false`.\n\n### Android Quirks\n\n- __pref__: Not supported, returning `false`.\n\n\n\u003cdetails\u003e\n\t\u003csummary\u003edeprecated platforms\u003c/summary\u003e\n\t\n### BlackBerry 10 Quirks\n\n- __type__: Partially supported.  Used for phone numbers.\n\n- __value__: Supported.\n\n- __pref__: Not supported, returning `false`.\n\n\u003c/details\u003e\n\n\n## ContactName\n\nContains different kinds of information about a `Contact` object's name.\n\n### Properties\n\n- __formatted__: The complete name of the contact. _(DOMString)_\n\n- __familyName__: The contact's family name. _(DOMString)_\n\n- __givenName__: The contact's given name. _(DOMString)_\n\n- __middleName__: The contact's middle name. _(DOMString)_\n\n- __honorificPrefix__: The contact's prefix (example _Mr._ or _Dr._) _(DOMString)_\n\n- __honorificSuffix__: The contact's suffix (example _Esq._). _(DOMString)_\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows\n- BlackBerry 10\n- Firefox OS\n- Amazon Fire OS\n- Windows Phone 8\n\n\n### Example\n\n```js\nfunction onSuccess(contacts) {\n    for (var i = 0; i \u003c contacts.length; i++) {\n        alert(\"Formatted: \"  + contacts[i].name.formatted       + \"\\n\" +\n            \"Family Name: \"  + contacts[i].name.familyName      + \"\\n\" +\n            \"Given Name: \"   + contacts[i].name.givenName       + \"\\n\" +\n            \"Middle Name: \"  + contacts[i].name.middleName      + \"\\n\" +\n            \"Suffix: \"       + contacts[i].name.honorificSuffix + \"\\n\" +\n            \"Prefix: \"       + contacts[i].name.honorificSuffix);\n    }\n};\n\nfunction onError(contactError) {\n    alert('onError!');\n};\n\nvar options = new ContactFindOptions();\noptions.filter = \"\";\noptions.multiple = true;\nfilter = [\"displayName\", \"name\"];\nnavigator.contacts.find(filter, onSuccess, onError, options);\n```\n\n### Android Quirks\n\n- __formatted__: Partially supported, and read-only.  Returns a concatenation of `honorificPrefix`, `givenName`, `middleName`, `familyName`, and `honorificSuffix`.\n\n### iOS Quirks\n\n- __formatted__: Partially supported.  Returns iOS Composite Name, but is read-only.\n\n### Windows Quirks\n\n- __formatted__: This is the only name property, and is identical to `displayName`, and `nickname`\n\n- __familyName__: not supported\n\n- __givenName__: not supported\n\n- __middleName__: not supported\n\n- __honorificPrefix__: not supported\n\n- __honorificSuffix__: not supported\n\n\n\u003cdetails\u003e\n\t\u003csummary\u003edeprecated platforms\u003c/summary\u003e\n\t\n### BlackBerry 10 Quirks\n\n- __formatted__: Partially supported.  Returns a concatenation of BlackBerry __firstName__ and __lastName__ fields.\n\n- __familyName__: Supported.  Stored in BlackBerry __lastName__ field.\n\n- __givenName__: Supported.  Stored in BlackBerry __firstName__ field.\n\n- __middleName__: Not supported, returning `null`.\n\n- __honorificPrefix__: Not supported, returning `null`.\n\n- __honorificSuffix__: Not supported, returning `null`.\n\n### FirefoxOS Quirks\n\n- __formatted__: Partially supported, and read-only.  Returns a concatenation of `honorificPrefix`, `givenName`, `middleName`, `familyName`, and `honorificSuffix`.\n\n\u003c/details\u003e\n\n\n## ContactOrganization\n\nThe `ContactOrganization` object stores a contact's organization\nproperties.  A `Contact` object stores one or more\n`ContactOrganization` objects in an array.\n\n### Properties\n\n- __pref__: Set to `true` if this `ContactOrganization` contains the user's preferred value. _(boolean)_\n\n- __type__: A string that indicates what type of field this is, _home_ for example. _(DOMString)\n\n- __name__: The name of the organization. _(DOMString)_\n\n- __department__: The department the contract works for. _(DOMString)_\n\n- __title__: The contact's title at the organization. _(DOMString)_\n\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows (Windows 8.1 and Windows Phone 8.1 devices only)\n- BlackBerry 10\n- Firefox OS\n- Windows Phone 8\n\n### Example\n\n```js\nfunction onSuccess(contacts) {\n    for (var i = 0; i \u003c contacts.length; i++) {\n        for (var j = 0; j \u003c contacts[i].organizations.length; j++) {\n            alert(\"Pref: \"      + contacts[i].organizations[j].pref       + \"\\n\" +\n                \"Type: \"        + contacts[i].organizations[j].type       + \"\\n\" +\n                \"Name: \"        + contacts[i].organizations[j].name       + \"\\n\" +\n                \"Department: \"  + contacts[i].organizations[j].department + \"\\n\" +\n                \"Title: \"       + contacts[i].organizations[j].title);\n        }\n    }\n};\n\nfunction onError(contactError) {\n    alert('onError!');\n};\n\nvar options = new ContactFindOptions();\noptions.filter = \"\";\noptions.multiple = true;\nfilter = [\"displayName\", \"organizations\"];\nnavigator.contacts.find(filter, onSuccess, onError, options);\n```\n\n### iOS Quirks\n\n- __pref__: Not supported on iOS devices, returning `false`.\n\n- __type__: Not supported on iOS devices, returning `null`.\n\n- __name__: Partially supported.  The first organization name is stored in the iOS __kABPersonOrganizationProperty__ field.\n\n- __department__: Partially supported.  The first department name is stored in the iOS __kABPersonDepartmentProperty__ field.\n\n- __title__: Partially supported.  The first title is stored in the iOS __kABPersonJobTitleProperty__ field.\n\n### Windows Quirks\n\n- __pref__: Not supported, returning `false`.\n\n- __type__: Not supported, returning `null`.\n\n### Android 2.X Quirks\n\n- __pref__: Not supported by Android 2.X devices, returning `false`.\n\n\u003cdetails\u003e\n\t\u003csummary\u003edeprecated platforms\u003c/summary\u003e\n\t\n### BlackBerry 10 Quirks\n\n- __pref__: Not supported by BlackBerry devices, returning `false`.\n\n- __type__: Not supported by BlackBerry devices, returning `null`.\n\n- __name__: Partially supported.  The first organization name is stored in the BlackBerry __company__ field.\n\n- __department__: Not supported, returning `null`.\n\n- __title__: Partially supported.  The first organization title is stored in the BlackBerry __jobTitle__ field.\n\n### Firefox OS Quirks\n\n- __pref__: Not supported\n\n- __type__: Not supported\n\n- __department__: Not supported\n\n- Fields __name__ and __title__ stored in __org__ and __jobTitle__.\n\n\u003c/details\u003e\n\n## ContactFieldType\nThe `ContactFieldType` object is an enumeration of possible field types, such as `'phoneNumbers'` or `'emails'`, that could be used to control which contact properties must be returned back from `contacts.find()` method (see `contactFindOptions.desiredFields`), or to specify fields to search in (through `contactFields` parameter). Possible values are:\n\n- `navigator.contacts.fieldType.addresses`\n- `navigator.contacts.fieldType.birthday`\n- `navigator.contacts.fieldType.categories`\n- `navigator.contacts.fieldType.country`\n- `navigator.contacts.fieldType.department`\n- `navigator.contacts.fieldType.displayName`\n- `navigator.contacts.fieldType.emails`\n- `navigator.contacts.fieldType.familyName`\n- `navigator.contacts.fieldType.formatted`\n- `navigator.contacts.fieldType.givenName`\n- `navigator.contacts.fieldType.honorificPrefix`\n- `navigator.contacts.fieldType.honorificSuffix`\n- `navigator.contacts.fieldType.id`\n- `navigator.contacts.fieldType.ims`\n- `navigator.contacts.fieldType.locality`\n- `navigator.contacts.fieldType.middleName`\n- `navigator.contacts.fieldType.name`\n- `navigator.contacts.fieldType.nickname`\n- `navigator.contacts.fieldType.note`\n- `navigator.contacts.fieldType.organizations`\n- `navigator.contacts.fieldType.phoneNumbers`\n- `navigator.contacts.fieldType.photos`\n- `navigator.contacts.fieldType.postalCode`\n- `navigator.contacts.fieldType.region`\n- `navigator.contacts.fieldType.streetAddress`\n- `navigator.contacts.fieldType.title`\n- `navigator.contacts.fieldType.urls`\n","funding_links":[],"categories":["Index"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-contacts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fcordova-plugin-contacts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-contacts/lists"}