Device-cloud data sync (device-cloud synergy) refers to data synchronization from devices (such as mobile phones, PCs, and tablets) to the cloud. It is often used to ensure app data consistency between multiple devices through the cloud.
In the device-cloud data synchronization scenario, data synchronization and storage between devices and the cloud are supported.
Before using the device-cloud synchronization capability, understand the following concepts:
Currently, two synchronization modes are supported for device-cloud data synchronization: manual synchronization and automatic synchronization. Developers can select a synchronization mode as required to implement device-cloud data synchronization.
Manual synchronization: The application calls the cloudSync API to trigger a synchronization. You need to specify the synchronization mode. There are three modes for data synchronization between the terminal and the cloud, which are respectively synchronizing data from an end with a relatively recent modification time to an end with a relatively distant modification time, synchronizing data from the terminal to the cloud, and synchronizing data from the cloud to the terminal.
Auto-synchronization: The distributed database automatically pushes device data to the cloud and pulls data from the cloud to the device to complete data synchronization. The synchronization time is controlled by the system, and the application does not need to (and cannot) intervene.
The device-cloud synchronization mechanism is cloud-centric and uses a centralized data synchronization model. This means that data is not synchronized between devices. Instead, data is synchronized between devices, clouds, and devices. The cloud is both a data backup center and a data transfer center. Device-cloud-device data synchronization ensures data consistency between multiple devices.
In the device-cloud synchronization scenario, if data on device A is changed, the data is incrementally uploaded to the cloud. If device B has subscribed to data changes on the cloud, the cloud sends a data change notification to device B. Device B can obtain the changed data from the cloud and write the data to the database. In this way, multi-device synchronization is implemented among device A, the cloud, and device B.
When data is added, deleted, or modified, a notification is sent to the subscriber.
Cloud data change notification: When data is added, deleted, or modified on another device logged in to the same cloud account, the device will receive a data change notification.
Cloud data change notification: When data is added, deleted, or modified on other devices logged in to the same cloud account, the device will receive a detailed notification about the device-cloud synchronization process, including the name of the changed table, type of the changed data, and location where the data or asset attachment is inserted, updated, or deleted.
The device-cloud synchronization function depends on the cloud service. The device-cloud synchronization function can be used only after the application environment is deployed on the cloud. For details, see Deploying the Cloud Environment for Device-Cloud Data Sync.
Device-cloud synchronization depends on the network. If the network is not connected or the network quality is poor, device-cloud synchronization will fail.
After the configuration on the cloud is updated, you need to log out of the HUAWEI ID on the device and then log in again to obtain the latest configuration on the cloud.