has.chooseContact(Object object)
Opens the phone address book to select a contact.
Since: 1.0.4
Parameters
The input parameter is an object containing the following fields.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| success | function | No | Callback triggered when the API call is successful. |
| fail | function | No | Callback triggered when the API call fails. |
| complete | function | No | Callback triggered when the API call is complete, regardless of success or failure. |
Return value of success
| Parameter | Type | Description |
|---|---|---|
| phoneNumber | string | Mobile number. |
| displayName | string | Contact name. |
Error code information
| Error Code | Error Message |
|---|---|
| 126 | chooseContact is not supported. |
| 12004101 | 1. chooseContact error. 2. no select contact. |
Example:
has.chooseContact({
success: (res) => {
console.info('chooseContact success', res);
},
fail: (err) => {
console.error('chooseContact fail', err);
},
complete: (res) => {
console.info('chooseContact complete', res);
}
}); has.addPhoneContact(Object object)
Adds a contact to the phone address book. The user may choose to save the form in the address book by either adding a contact or updating an existing contact.
Since: 1.0.13
Parameters
The input parameter is an object containing the following fields.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| firstName | string | Yes | First name. |
| photoFilePath | string | No | Local path of the profile picture. |
| remark | string | No | Remarks. |
| mobilePhoneNumber | string | No | Mobile number. |
| addressCountry | string | No | Country of the contact address. |
| addressState | string | No | Province of the contact address. |
| addressCity | string | No | City of the contact address. |
| addressStreet | string | No | Street of the contact address. |
| addressPostalCode | string | No | Postal code of the contact address. |
| organization | string | No | Company. |
| title | string | No | Job title. |
| workFaxNumber | string | No | Work fax number. |
| workPhoneNumber | string | No | Business phone number. |
| hostNumber | string | No | Phone number of a company. |
| string | No | Email address. | |
| url | string | No | Website. |
| workAddressCountry | string | No | Country of the work address. |
| workAddressState | string | No | Province of the work address. |
| workAddressCity | string | No | City of the work address. |
| workAddressStreet | string | No | Street of the work address. |
| workAddressPostalCode | string | No | Postal code of the work address. |
| homeFaxNumber | string | No | Home fax number. |
| homePhoneNumber | string | No | Home phone number. |
| homeAddressCountry | string | No | Country of the home address. |
| homeAddressState | string | No | Province of the home address. |
| homeAddressCity | string | No | City of the home address. |
| homeAddressStreet | string | No | Street of the home address. |
| homeAddressPostalCode | string | No | Postal code of the home address. |
| success | function | No | Callback triggered when the API call is successful. |
| fail | function | No | Callback triggered when the API call fails. |
| complete | function | No | Callback triggered when the API call is complete, regardless of success or failure. |
Error code information
| Error Code | Error Message |
|---|---|
| 126 | addPhoneContact is not supported on this device, higher sdk is required. |
| 12004001 | addPhoneContact error. |
Example:
has.addPhoneContact({
firstName: 'XX',
success: () => {
console.info('addPhoneContact success');
},
fail: (err) => {
console.error('addPhoneContact fail', err);
},
complete: (res) => {
console.info('addPhoneContact complete', res);
}
});