my.choosePhoneContact allows users to select a phone number from their local system directory. This API opens the device's contact picker and returns the selected contact's information.
my.choosePhoneContact({
success: (res) => {
my.alert({
content: 'choosePhoneContact response: ' + JSON.stringify(res)
});
},
fail: (res) => {
my.alert({
content: 'choosePhoneContact response: ' + JSON.stringify(res)
});
},
});
| Property | Type | Required | Description |
|---|---|---|---|
success | Function | No | Callback function upon call success. |
fail | Function | No | Callback function upon call failure. |
complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure). |
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Description |
|---|---|---|
name | String | Selected contact name. |
mobile | String | Selected contact phone. |
| Error Code | Description |
|---|---|
10 | No permission. |
11 | The user cancels the operation (or the device does not authorize use of the directory). |