• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3734

entry/12-May-2024-1,8671,594

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024100 77

README.mdD12-May-20241.4 KiB3618

README_zh.mdD12-May-20241.7 KiB3719

build-profile.json5D12-May-20241 KiB4241

hvigorfile.jsD12-May-2024168 21

package.jsonD12-May-2024378 1818

README.md

1# Distributed Notepad
2
3### Introduction
4
5This sample shows how to implement a simple distributed Notepad using distributed data objects in eTS. The display effect is as follows:
6
7![home](screenshots/devices/home_en.png)
8
9### Concepts
10
11Distributed data object: You can synchronize data between devices on a network by configuring distributed data objects with the same session ID for these devices. When a distributed object is modified, the peer device can listen for data changes and obtain new data.
12
13### Required Permissions
14
15ohos.permission.DISTRIBUTED_DATASYNC
16
17### Usage
18
191. Start the app, touch the button in the upper right corner, and select the device to connect. After the connection is successful, the home screens of the two devices are displayed in green. Each time you connect to another device, the notes will be cleared.
20
212. To add a note, touch the **Add** button, edit the title and note content, mark color, and touch the **Submit** button.
22
233. To clear all notes, touch the **Clear** button.
24
254. To modify a note, touch the note, modify the note content, and touch **Submit**.
26
275. The operations performed in steps 2, 3, and 4 are synchronized to the connected device.
28
29### Constraints
30
31- This sample can only be run on standard-system devices.
32
33- This sample is based on the stage model, which is supported from API version 9.
34
35- This sample requires DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.
36

README_zh.md

1# 分布式备忘录
2
3### 简介
4
5本示例展示了在eTS中如何使用分布式数据对象实现一个简单的分布式备忘录。实现效果如下:
6
7![home](screenshots/devices/home.png)
8
9### 相关概念
10
11分布式数据对象:组网内的设备,通过创建相同sessionId的分布式数据对象,修改分布式对象时,对端设备可以监听到数据变化并获取到新的数据,从而实现不同设备间的数据交换。
12
13### 相关权限
14
15允许不同设备间的数据交换:ohos.permission.DISTRIBUTED_DATASYNC
16
17### 使用说明
18
191.启动应用,点击右上角按钮可以连接组网设备,选择设备后进行连接,连接成功后两个设备上首页状态均显示绿色,每次连接其他设备,界面会清空备忘录内容。
20
212.点击**添加**按钮进入添加界面,可以编辑标题、内容、标记颜色,点击**提交**按钮添加备忘录。
22
233.点击**清除**按钮清除所有备忘录内容。
24
254.点击已经添加的备忘录可以进入编辑界面更新备忘录内容,编辑完成后点击**提交**按钮更新备忘录。
26
275.两台设备连接成功后步骤2、3、4的操作会同步到另一台设备上。
28
29### 约束与限制
30
311.本示例仅支持标准系统上运行。
32
332.本示例为Stage模型,从API version 9开始支持。
34
353.本示例需要使用DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100)及以上才可编译运行。
36
374.本示例需要使用@ohos.distributedHardware.deviceManager系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)