| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 06-May-2025 | - | 36 | 33 | ||
| entry/ | 06-May-2025 | - | 2,611 | 2,392 | ||
| hvigor/ | 06-May-2025 | - | 24 | 22 | ||
| screenshots/ | 06-May-2025 | - | ||||
| .gitignore | D | 06-May-2025 | 98 | 9 | 9 | |
| README.md | D | 06-May-2025 | 2.4 KiB | 38 | 19 | |
| README_zh.md | D | 06-May-2025 | 4.3 KiB | 86 | 63 | |
| build-profile.json5 | D | 06-May-2025 | 1 KiB | 42 | 41 | |
| hvigorfile.ts | D | 06-May-2025 | 158 | 2 | 1 | |
| hvigorw | D | 06-May-2025 | 2.1 KiB | 62 | 28 | |
| hvigorw.bat | D | 06-May-2025 | 2 KiB | 73 | 56 | |
| oh-package.json5 | D | 06-May-2025 | 813 | 27 | 25 | |
| ohosTest.md | D | 06-May-2025 | 4.3 KiB | 49 | 46 |
README.md
1# Contact 2 3### Introduction 4 5This sample shows how to use the mobile phone contact function. 6 7In this example, we'll use the [Tabs](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkui/arkui-ts/ts-container-tabs.md) component to set the overall application layout, and use the [List](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkui/arkui-ts/ts-container-list.md) component to set the page layout of the home page, and use the [AlphabetIndexer](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkui/arkui-ts/ts-container-alphabet-indexer.md) component to set the index bar. 8 9Usage 10 111. Touch **+** to go to the page for adding a contact. Enter the contact information, and then tap **√** to confirm and return to the home page. 12 132. Touch the contact list to view the detailed contact information. You can also edit or delete the contact information as needed. 14 153. Enter a number or email address in the search box to search for a contact. 16 17### Display Effect 18 19  20 21### Required Permissions 22 23Reading of contact information: [ohos.permission.READ_CONTACTS](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AccessToken/restricted-permissions.md) 24 25Adding, removing, and changing contact information: [ohos.permission.WRITE_CONTACTS](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AccessToken/restricted-permissions.md) 26 27### Dependency 28 29N/A 30 31### Constraints 32 331. This sample can only be run on standard-system devices that use the Rockchip RK3568 chip. 34 352. DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) must be used. 36 373. [ohos.permission.READ_CONTACTS](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AccessToken/restricted-permissions.md) and [ohos.permission.WRITE_CONTACTS](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AccessToken/restricted-permissions.md) are permissions of the system_basic level, which can be viewed from the permission list (https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/AccessToken/restricted-permissions.md). You need to manually configure the signature of the corresponding permission level by following instructions in [Having Your App Automatically Signed](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/hapsigntool-overview.md/). 38
README_zh.md
1# 联系人 2 3### 介绍 4 5本示例使用[@ohos.contact](https://docs.openharmony.cn/pages/v4.1/zh-cn/application-dev/reference/apis-contacts-kit/js-apis-contact.md) 6接口,实现了对联系人的增删查改功能。 7 8### 效果预览 9 10|首页|详情页|新建联系人| 11|-----|-----|-----| 12| ||| 13 14使用说明 15 161.点击 **+** 按钮,跳转添加联系人界面,输入联系人信息,点击 **√**,确认添加联系人,并返回首页; 17 182.点击联系人列表跳转页面查看详细信息,并且可以编辑或删除联系人信息; 19 203.在搜索栏输入号码或邮箱可查询对应的联系人。 21 22### 工程目录 23``` 24entry/src/main/ets/ 25|---component 26| |---Contact.ets // 联系人页面 27| |---ContactInfo.ets // 联系人详情页主体内容 28| |---Home.ets // 主页主体内容 29| |---ItemContainer.ets // 联系人列表 30| |---NewContact.ets // 新建联系人页面主体内容 31| |---UpdateContact.ets 32|---data // 日志文件 33|---entryability 34| |---EntryAbility.ets // 应用入口,在这里请求相关权限 35|---pages 36| |---AddContact.ets // 新建联系人页面 37| |---EditContact.ets // 编辑联系人 38| |---Index.ets // 主页 39| |---NameCard.ets // 联系人详情页 40| |---Setting.ets // 设置页面 41``` 42 43### 具体实现 44* 本示例的主要逻辑功能和源码在下列相关类中: 45 * 查询所有联系人:在[Contact.ets](entry/src/main/ets/component/Contact.ets) 46 页面调用contact.queryContacts()查询所有的联系人; 47 * 新建联系人:在[AddContact.ets](entry/src/main/ets/pages/AddContact.ets) 48 页面检验数据格式后通过contact.addContact()创建新的联系人; 49 * 搜索联系人:在[Contact.ets](entry/src/main/ets/component/Contact.ets) 50 页面调用contact.queryContactsByPhoneNumber()通过电话号码查询联系人或者调用contact.queryContactsByEmail()通过邮箱查询联系人; 51 * 删除联系人:在[ContactInfo.ets](entry/src/main/ets/component/ContactInfo.ets) 52 调用contact.deleteContact()删除指定的联系人; 53 * 修改联系人:在[EditContact.ets](entry/src/main/ets/pages/EditContact.ets) 54 页面调用contact.updateContact()。 55 56### 相关权限 57 58[ohos.permission.READ_CONTACTS](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionread_contacts) 59 60[ohos.permission.WRITE_CONTACTS](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionwrite_contacts) 61 62### 依赖 63 64不涉及。 65 66### 约束与限制 67 681. 本示例仅支持标准系统上运行,支持设备:RK3568。 69 702. 本示例需要使用DevEco Studio 3.1 Beta2 (Build Version: 3.1.0.400, built on April 7, 2023)及以上版本才可编译运行。 71 723. 本示例已适配API version 9版本SDK,版本号:3.2.11.9。 73 744. 本示例涉及[ohos.permission.READ_CONTACTS](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionread_contacts)、[ohos.permission.WRITE_CONTACTS](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionwrite_contacts) 为system_basic级别(相关权限级别可通过[权限定义列表](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-all.md))查看),需要手动配置对应级别的权限签名(具体操作可查看[自动化签名方案](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/hapsigntool-overview.md)。 75 76### 下载 77 78如需单独下载本工程,执行如下命令: 79 80``` 81git init 82git config core.sparsecheckout true 83echo code/BasicFeature/Telephony/Contact/ > .git/info/sparse-checkout 84git remote add origin https://gitee.com/openharmony/applications_app_samples.git 85git pull origin master 86```