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:

PropertyType

Required

Description
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback 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:

PropertyTypeDescription
nameStringSelected contact name.
mobileStringSelected contact phone.

Error Code

Error CodeDescription
10No permission. 
11The user cancels the operation (or the device does not authorize use of the directory).