my.choosePhoneContact
Select the phone number of a contact in the local system directory.
Sample Code
copy
//.json
{
"defaultTitle": "Contact"
}
copy
<!-- .axml -->
<view class="page">
<view class="page-description">Contact API</view>
<view class="page-section">
<view class="page-section-title">my.choosePhoneContact</view>
<view class="page-section-demo">
<button type="primary" onTap="choosePhoneContact">Evoke local directory</button>
</view>
</view>
</view>
</view>
copy
//.js
Page({
choosePhoneContact() {
my.choosePhoneContact({
success: (res) => {
my.alert({
content: 'choosePhoneContact response: ' + JSON.stringify(res)
});
},
fail: (res) => {
my.alert({
content: 'choosePhoneContact response: ' + JSON.stringify(res)
});
},
});
}
});
Parameters
Object type with the following attributes:
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). |
Success Callback Function
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
Error Code | Description |
10 | No permission. |
11 | The user cancels the operation (or the device does not authorize use of the directory). |