# DistributedContacts **Repository Path**: harmonyos4me/DistributedContacts ## Basic Information - **Project Name**: DistributedContacts - **Description**: 本篇Codelab以通讯录为例,介绍分布式键值数据库的创建、数据的增加/删除/修改/查询/同步等操作方法。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 12 - **Created**: 2024-12-19 - **Last Updated**: 2024-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Distributed Contacts ## Introduction With Contacts as an example, this codelab will show you how to create a distributed key-value (KV) store and how to add, delete, modify, query, and synchronize data. ![](screenshots/device/contact.en.gif) ## Concepts - Application data persistence: refers to the process in which applications save data in the memory to devices in the form of files or databases. The data in the memory is usually saved in the forms of data structs or data objects, while the data in storage media can be saved in the forms of text, databases, or binary files. - KV store: stores data in the form of KV pairs. It allows you to store data organized in a simple model, for example, product names and prices, or employee IDs and daily attendances. The simple data structure allows higher compatibility with different database versions and device types. - **@ohos.data.distributedKVStore** (distributed KV store): provides the distributed synergy capability between databases of different devices for applications. By calling the APIs, applications can save data to a distributed KV store and perform operations, such as adding, deleting, modifying, and querying data in the distributed KV store. ## Permissions This codelab uses the distributed capability. It requires you to add the data exchange permission **ohos.permission.DISTRIBUTED_DATASYNC** to the **module.json5** configuration file. ## How to Use 1. On the app home page, tap the Add button in the upper right corner. You can create a contact. 2. On the app home page, tap the More button in the upper right corner and then Batch Delete. You can delete contacts in batches. 3. On the app home page, tap Contacts to access the contact details page. 4. On the contact details page, tap Edit to edit a contact. 5. On the contact details page, tap Delete to delete a contact. 6. On the New Contact page, enter the contact information and tap Save in the upper right corner to add a contact. 7. On the batch deletion page, tap Select All to select or deselect all contacts. 8. On the batch deletion page, select the contacts to be deleted and tap Delete. 9. On the contact editing page, edit the contact information and tap Save in the upper right corner. You can modify the contact information. ## Constraints 1. The sample is only supported on Huawei phones with standard systems. 2. HarmonyOS: HarmonyOS NEXT Developer Beta1 or later. 3. DevEco Studio: DevEco Studio NEXT Developer Beta1 or later. 4. HarmonyOS SDK: HarmonyOS NEXT Developer Beta1 SDK or later.