my.choosePhoneContact
Selects a phone number from the device's local contacts.
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 invoked when the call completes, regardless of 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. |
Verify that the required permission is granted. |
|
11 |
The user cancels the operation (or the device hasn’t been authorized to use the directory). |
Authorize the device to access the contacts directory. |
Sample code
my.choosePhoneContact({
success: (res) => {
my.alert({
content: 'Name:' + res.name + '\nPhone number:' + res.mobile
});
},
});
该文章对您有帮助吗?