Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Data syncing allows you to store data to HUAWEI Mobile Cloud in a timely manner and sync data between devices logged in to the same HUAWEI ID. This function is used to meet the following experience requirements:
You need to go to Settings > Cloud and turn on the syncing switch, and make sure that HUAWEI Mobile Cloud has sufficient storage space.
Easy integration
Simplified development: Developers can use the device-cloud synchronization function to quickly add the cloud synchronization function for applications.
Focus on the core: Developers only need to focus on the core service logic of applications. The complexity of data synchronization is handled by ArkData and cloud space.
Cost saving: You do not need to set up and manage servers, databases, storage resources, or bandwidth resources.
Seamless all-scenario synchronization
Wide coverage: Devices that support synchronization include mobile phones, tablets, and PCs.
Timely and consistent: Automatic and timely synchronization of user data ensures consistent experience.
Offline availability: Even if the consumer device is temporarily disconnected from the network, the local data can be accessed and used normally. After the network is restored, the changes are automatically synchronized to the cloud and other devices.
Security and privacy
Secure storage: User data is stored in HUAWEI Mobile Cloud in the form of multiple copies, which is more reliable.
Privacy protection: Encrypts user data before storing it to the cloud, ensuring that user data can be accessed only by the user.
Easy to use
Easy to use: You only need to log in to your HUAWEI ID and turn on the synchronization switch. The service will be automatically enabled.
Easy data management: HUAWEI Mobile Cloud provides a unified and easy-to-use settings and data management screen. Users can manage synchronization and data stored on the cloud by choosing Settings > Cloud.
The access needs to be configured on both the cloud and device. On the cloud, you need to create a container and configure data types to determine the data storage space and cloud fields of your app in the cloud space. On the device, you need to declare the access fields and connection environment to display the sync switch and debug the sync function on the device.
Go to the cloud synchronization page.
Sign in to AppGallery Connect, click Development and services, and select My projects.
Find your project and click the app for which you want to create a container.
Enable the cloud space on the API management or open capability management page.
Click All Features (below the left navigation tree), go to the cloud space service page under Build, and click the fixed button to display the service in the left navigation tree.
Run the following command to create a container:
On the cloud synchronization service page, create a container with custom name.
The container name must be the same as the local ArkData database name. For example, if the ArkData database name is note.db, the container name is note (case-sensitive). You do not need to enter the suffix.
You can access the data type configuration page only after the container is created.
Configure the data type.
On the Cloud Synchronization Service page, click the Data Type Configuration tab, and set data type and custom field. You can add, delete, modify, and query data types as required.
The data type name must be the same as the name of the local ArkData table.
The name and type of the custom field on the cloud must be the same as those of the field for local data to access the cloud space. The change relationships are as follows.
| Cloud Field Type | Local Field Type |
|---|---|
| Encrypted String/String | TEXT |
| Integer | INTEGER |
| Double | DOUBLE |
| Bytes | BLOB |
When setting the type of a customized field, if the field is of the string type, you can select an encrypted field (with the prefix Encrypted) to protect user data privacy.
After a field is added as an encrypted field, the performance and efficiency of device-cloud synchronization may be affected. You are advised to select an encrypted field based on the data security level.
By default, all configuration fields on the cloud can be empty. The NOT NULL attribute cannot be set for all fields in the local ArkData table.
When setting a field in the ArkData local table to the primary key, you need to perform the following operations on the cloud: Expand the advanced settings, drop-down deduplicate primary key on device, and select the field for which the primary key attribute is set locally.
Commission multi-device synchronization.
Commissioning scheme 1:
On the home page of the cloud synchronization service, choose Data record debugging, select the data type and field to be viewed from the Data type and Field drop-down lists, and click Search to view personal data on the cloud.
On this page, you can only query and modify the data of your own account. If other accounts are used for device-side commissioning, you cannot query the data on this page. To use this page, log in to the same developer account for client commissioning.
The content of encrypted fields cannot be viewed on the data record commissioning page. To view the content of encrypted fields, use commissioning scheme 2.
Data occupies cloud storage space. Make sure there is enough space.
Commissioning scheme 2:
Log in to the two devices using the same account. Open the app on device A and add data. Then open the app on device B and check whether the data written on device A is synchronized to the local device.
Reset the development environment.
Developers can perform this operation to quickly delete a large amount of temporary data and configurations generated during commissioning.
On the Cloud Sync home page, click Reset Development Environment, select I understand that all data will be deleted and cannot be retrieved, and click Reset in the dialog box that is displayed.
All data type configurations will be reset (if the configurations have been changed to the production environment, the configurations will be the same as those in the production environment). All personal data will be cleared and the operation cannot be undone. Exercise caution when performing this operation.
Deploying the production environment
After the multi-device synchronization commissioning is complete in the development environment and the configuration meets service requirements, developers can change the development environment configuration to the production environment. If new configurations are added later, repeat this operation.
On the Cloud Synchronization Service page, select Change to production environment and click Implement in the displayed dialog box.
Exercise caution when performing this operation. After the operation is performed, the operation cannot be withdrawn, and the configuration cannot be deleted or modified. Only the configuration can be added.
App declaration
You can configure the cloudStructuredDataSyncEnabled field in the app tag of the app.json5 file to determine whether to access the cloud synchronization capability. If the field is set to true, the cloud synchronization capability is accessed. You can view the application switch in Settings > Cloud.
{
"app": {
"cloudStructuredDataSyncEnabled": true
}
} Environment connection
If the certificate type of the app is debug, the app connects to the development environment. If the certificate type of the app is release, the app connects to the production environment.
For details about the development process, see Developing RDB Store for Device-Cloud Data Synchronization (ArkTS).
Experience design suggestions.
When the in-app settings synchronization switch is turned on, prompt and guide the user to go to the cloud space page to turn on the switch.
User data is a valuable data asset of users and one of the important reasons for continuous use of applications. It is recommended that the synchronization status be explicit to make services more transparent and users more comfortable.
Synchronization is affected by the function enabling status, network conditions, and cloud storage space. For details, see Device-Cloud Synchronization Status Code. Example:
Added the notification "Syncing with Cloud" when the synchronization is in progress.
If the synchronization is complete and the completion status code is available, add a reminder by referring to the following table.
| completion status code | Suggestion |
|---|---|
| 0 | Synced with cloud. |
| 1 | Syncing with cloud paused. |
| 2 | Network error. Syncing with cloud paused. |
| 3 | Sync disabled. |
| 4 | Cloud syncing paused. It will automatically resume later. |
| 5 | Data limit exceeded. Syncing with cloud paused. |
| 6 | Insufficient cloud storage. Go to Settings > Cloud to manage. |
| 7 | No Wi-Fi connection. Syncing with cloud paused. |
Go to Settings > Cloud. You can also add a Deeplink text link. You can click the link to go to the cloud space home page. The URI is hicloud://cloudDrive/getInfo?path=MainActivity.
This document describes the processing of personal data where Huawei acts as the data processor and the developer acts as the data controller for end-user data. It covers the following:
| Personal Data | Processing Purpose | Retention Period |
|---|---|---|
| User data | Data backup and synchronization. The scope of data stored on the cloud is specified by the app and confirmed by the end user (by going to Settings > Cloud to enable or disable the syncing function). This is to prevent permanent data loss caused by app uninstallation, device loss, or device damage, and ensure data consistency between devices logged in to the same HUAWEI ID. | Data stored on the cloud will be retained until the end user deletes the data. |
How to clear end users' data stored on the cloud
End users can delete data stored on the cloud by going to the storage space management page under Settings > Cloud and using the ''stop syncing and delete cloud data'' feature. Data stored on the device will not be deleted.
How to export end-user data
It is recommended that the app provide the in-device export function.
How to ensure that users are aware of data management rights
Describe the purpose and scope of storing data to the cloud in the privacy statement. You can refer to the following information (which can be adjusted by developers): For the purpose of {user experience description}, {data item name} and other data will be synced between devices logged in to HUAWEI ID through HUAWEI Mobile Cloud. You can manage the syncing feature and data stored on Cloud by going to Settings > Cloud.
On the Development and services page, expand all features in the lower left corner. Find cloud space servces under Build and pin it to the navigation tree on the left for future use.
The possible solutions are listed below:
If the problem persists, try the following:
Log out of the HUAWEI ID and log in again.