diff --git a/README.en.md b/README.en.md index 8853aa584fc6879b2816117cbee57ef85cae8a44..6bcbd069bf15c6408bb2cd5981acad9c6617dd81 100644 --- a/README.en.md +++ b/README.en.md @@ -1,55 +1,53 @@ -# Realization of distributed mail function based on application connection +# Implementing a Distributed Email Application Based on Application Continuation ## Overview -Based on application connection and distributed data objects, this Codelab implements distributed mail applications. It mainly includes the following functions: +This codelab implements a distributed email application based on features such as application continuation and distributed data objects. You will learn how to implement the following features: +1. Data transmission across devices by using distributed data objects +2. Application continuation and data transmission by tapping the Dock bar -1. Transfer data across devices through distributed data objects. -2. By clicking on the system Dock bar, the application can be connected and data can be transmitted. - -## Preview +## Effect ## How to Use -1. Enter the home page of the application, and you can enter the corresponding contents in the recipient, sender and subject text boxes. -2. Open the distributed mail application on the local side, and a distributed mail application icon will be added in the Dock bar of the opposite device. Click the distributed mail application, and the local application will be connected to the opposite device. - +1. On the application home page, enter the recipient, sender, and subject in the text boxes. +2. Open the distributed mail application on your local device. The distributed mail application icon will appear on the Dock of your peer device. Click the application icon, and you can continue with operations in the app on your peer device. ## Project Directory ``` -├──entry/src/main/ets -│ ├──entryability -│ │ └──EntryAbility.ets // Entry file -│ ├──pages -│ │ └──MailHomePage.ets // Mail home page -│ └──utils -│ └──MailInfoManager.ets // Mail information management class -└──entry/src/main/resources // Resource file +├──entry/src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets // Entry ability +│ ├──pages +│ │ └──MailHomePage.ets // Mail home page +│ └──utils +│ └──MailInfoManager.ets // Mail information management class +└──entry/src/main/resources // Resource files ``` ## How to Implement -1. Configure the migrate tag, and configure the sustainable tag in "src/main/module.json5": true means migration is supported, false means migration is not supported, and the default value is false. -2. Call the distributedDataObject.create() interface to create a distributed data object, and fill the data to be migrated into the distributed data object data. -3. Call the distributedDataObject.genSessionid() interface to generate the networking id of the data object, and use this id to call setSessionId() to join the networking and activate the distributed data object. -4. Call the distributedDataObject.save () interface to persist the activated distributed data object. -5. Call setMissionContinueState() to set the migration status to ACTIVE and create an empty distributed data object to receive the recovered data. -6. Read the networking id of distributed data objects from want, call setSessionId() to join the networking, and activate the distributed data objects. -7. Register the on() interface to monitor data changes. When receiving the callback of the event with the status of restore, obtain the basic information of the mail saved when the A device exits through the distributed data object, and save it in AppStorage for the B device to obtain and use. -8. Manually load the page to be restored in the onWindowStageRestore() life cycle. +1. Set the continuable tag in src/main/module.json5 to true. The default value is false. +2. Call [distributedDataObject.create()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-data-distributedobject#distributeddataobjectcreate9) API to create a distributed data object, and fill the data to be migrated into the distributed data object. +3. Call [distributedDataObject.genSessionId()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-data-distributedobject#distributeddataobjectgensessionid) to generate a session ID for the distributed data object, and call [setSessionId()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-data-distributedobject#setsessionid9) with this ID to add the device to the network and activate the distributed data object. +4. Call [distributedDataObject.save()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-data-distributedobject#save9) API to persist the activated distributed data object. +5. Call [setMissionContinueState()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-inner-application-uiabilitycontext#setmissioncontinuestate10) to set the migration status to ACTIVE, and create an empty distributed data object for receiving data to be restored. +6. Read the networking ID of the distributed data object from want, and call [setSessionId()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-data-distributedobject#setsessionid9) with this ID to add the device to the network and activate the distributed data object. +7. Register on() to listen for data changes. In the callback of the event whose status is restore, the basic email information saved when device A exits is obtained through the distributed data object and saved in the AppStorage for device B to obtain. +8. Manually load the page to be restored in the [onWindowStageRestore()](https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-app-ability-abilitylifecyclecallback#onwindowstagerestore12) lifecycle. -## Permissions +## Required Permissions N/A. ## Constraints -1. The sample is only supported on Huawei phones with standard systems. -2. The HarmonyOS version must be HarmonyOS 5.1.1 Release or later. -3. The DevEco Studio version must be DevEco Studio 5.1.1 Release or later. -4. The HarmonyOS SDK version must be HarmonyOS 5.1.1 Release SDK or later. -5. Double-ended devices need to log in to the same Huawei account, so it is recommended to turn on the device finding function. -6. Double-ended devices need to turn on the Wi-Fi and Bluetooth switches. When conditions permit, it is recommended to connect to the same LAN. -7. Both end devices need this application. +1. This sample is only supported on Huawei phones running standard systems. +2. The HarmonyOS version must be HarmonyOS 6.0.0 Release or later. +3. The DevEco Studio version must be DevEco Studio 6.0.0 Release or later. +4. The HarmonyOS SDK version must be HarmonyOS 6.0.0 Release SDK or later. +5. Both devices must be logged in with the same HUAWEI ID. +6. Wi-Fi and Bluetooth must be enabled on both devices. If possible, both devices should be connected to the same LAN to improve the data transmission speed. +7. Application continuation can be triggered only between the same application (UIAbility) of both devices, that is, the application must have been installed on the two devices. diff --git a/README.md b/README.md index ca1b4de93ee84947cb6db11602b406b6f08723b7..fdb18a5067b9ca6fe3a0e97e46bba1040092fb1e 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,9 @@ ## 约束与限制 1. 本示例仅支持标准系统上运行,支持设备:华为手机。 -2. HarmonyOS系统:HarmonyOS 5.1.1 Release及以上。 -3. DevEco Studio版本:DevEco Studio 5.1.1 Release及以上。 -4. HarmonyOS SDK版本:HarmonyOS 5.1.1 Release SDK及以上。 +2. HarmonyOS系统:HarmonyOS 6.0.0 Release及以上。 +3. DevEco Studio版本:DevEco Studio 6.0.0 Release及以上。 +4. HarmonyOS SDK版本:HarmonyOS 6.0.0 Release SDK及以上。 5. 双端设备需要登录同一华为账号。 6. 双端设备需要打开Wi-Fi和蓝牙开关。条件允许时,建议双端设备接入同一个局域网,可提升数据传输的速度。 7. 应用接续只能在同应用(UIAbility)之间触发,双端设备都需要有该应用。 diff --git a/screenshots/devices/email.en.gif b/screenshots/devices/email.en.gif index d2569c83e46a1a0375897c0bdeee54ed4322c550..086fb5d9fd7b017d2e1d292ed559464d18dc65c8 100644 Binary files a/screenshots/devices/email.en.gif and b/screenshots/devices/email.en.gif differ