This interface is used to select the phone number of a contact from the local directory.
Parameters
Parameter |
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). |
Return value on success
Name |
Type |
Description |
name |
String |
Selected contact name. |
mobile |
String |
Selected phone number of the contact. |
Error code
error |
Description |
Solution |
10 |
No permission. |
Check the permission. |
11 |
The user cancels the operation (or the device hasn’t been authorized to use the directory). |
It is recommended to authorize the device for using directoy. |
Sample code
my.choosePhoneContact({
success: (res) => {
my.alert({
content: 'Name:' + res.name + '\nPhone number:' + res.mobile
});
},
});