This sample shows how to implement a simple distributed Notepad using distributed data objects in eTS. The display effect is as follows:
Distributed 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.
ohos.permission.DISTRIBUTED_DATASYNC
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.
To add a note, touch the Add button, edit the title and note content, mark color, and touch the Submit button.
To clear all notes, touch the Clear button.
To modify a note, touch the note, modify the note content, and touch Submit.
The operations performed in steps 2, 3, and 4 are synchronized to the connected device.
This sample can only be run on standard-system devices.
This sample is based on the stage model, which is supported from API version 9.
This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарий ( 0 )