Data synchronization method and electronic equipment

By acquiring and sending data to be synchronized in the application database, the function of users selecting synchronized applications according to their needs is realized, solving the problem of poor user experience in the existing technology, and improving the user experience and efficiency of data synchronization.

CN120104692APending Publication Date: 2025-06-06HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311636503.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-29
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The prior art cannot enable users to select synchronized applications according to their own needs, resulting in poor user experience in data synchronization from device level to application level.

Method used

By obtaining the data to be synchronized in the application database in the electronic device and sending these data to the corresponding electronic device, only the data of the selected application is synchronized.

Benefits of technology

This enables users to choose synchronized applications according to their own needs, improves the user experience and avoids the transmission confusion of device-level data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104692A_ABST
    Figure CN120104692A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is applicable to the field of data processing, and provides a data synchronization method and electronic equipment, the method is applied to first electronic equipment, the first electronic equipment is in communication connection with second electronic equipment, the first electronic equipment runs at least two application programs, and the at least two application programs comprise a first application program and a second application program. First electronic equipment comprises a first application database corresponding to a first application program, first to-be-synchronized data in the first application database is obtained, the first to-be-synchronized data is data corresponding to the first application program, and the first to-be-synchronized data is sent to second electronic equipment. Therefore, the first electronic equipment and the second electronic equipment can only synchronize the data of the selected application program instead of synchronizing all data in the first electronic equipment, and data synchronization is converted from equipment-level data synchronization to application-level data synchronization, so that the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and more specifically, to a data synchronization method and an electronic device. Background Art

[0002] At present, the same user usually owns multiple electronic devices, and the data can be automatically synchronized between the electronic devices.

[0003] For example, user A has two electronic devices, a smartphone 10 and a tablet computer PAD 30, and the smartphone 10 and the tablet computer PAD 30 are logged into the same account information. Photos taken by user A through the smartphone 10 can be automatically synchronized to the PAD 30, so that user A can easily view photos in the PAD 30. However, at this stage, users can only choose whether to enable the data synchronization function of the electronic device. If the user chooses to enable the data synchronization function in the smartphone 10, all applications in the smartphone 10 will enable the data synchronization function. The user cannot enable the data synchronization function of some applications in the smartphone 10, which will result in a poor user experience.

[0004] Based on this, how to achieve data synchronization based on user selection has become an urgent problem to be solved. Summary of the invention

[0005] The present application provides a data synchronization method, which can realize data synchronization based on user selection.

[0006] In a first aspect, a data synchronization method is provided. The method is applied to a first electronic device. The first electronic device is communicatively connected to a second electronic device. The first electronic device runs at least two applications, the at least two applications include a first application, and the first electronic device includes a first application database corresponding to the first application. The method includes:

[0007] Acquire first data to be synchronized in the first application database, where the first data to be synchronized is data corresponding to the first application program;

[0008] The first data to be synchronized is sent to the second electronic device.

[0009] The data synchronization method provided in the embodiment of the present application is applied to a first electronic device, where the first electronic device is communicatively connected with a second electronic device, where the first electronic device runs at least two applications, where the at least two applications include a first application, and where the first electronic device includes a first application database corresponding to the first application. The method obtains first data to be synchronized in the first application database, where the first data to be synchronized is data corresponding to the first application, and sends the first data to be synchronized to the second electronic device, which is equivalent to data synchronization between the first electronic device and the second electronic device, where the synchronized data is data in the first application database in the first electronic device, so that only data of the selected application can be synchronized between the first electronic device and the second electronic device, rather than synchronizing data of all applications in the first electronic device and the second electronic device, so that the user can select the synchronized application according to their own needs, thereby transforming data synchronization from device-level data synchronization to application-level data synchronization, and improving user experience.

[0010] In combination with the first aspect, in certain embodiments of the first aspect, the first electronic device includes a computing unit and a communication unit, and obtains the first data to be synchronized in the first application database, including: the computing unit obtains the first data to be synchronized in the first application database; sends the first data to be synchronized to the second electronic device, including: the computing unit sends the first data to be synchronized to the communication unit; the communication unit sends the first data to be synchronized to the second electronic device.

[0011] In combination with the first aspect, in certain embodiments of the first aspect, a computing unit determines a first list, the first list includes at least one error code, and the error code is used to indicate the type of failure when the computing unit fails to send data to the communication unit; the computing unit sends first data to be synchronized to the communication unit, and receives a first message returned by the communication unit, the first message is used to indicate whether the sending of the first data to be synchronized to the communication unit is successful; if the first message indicates that the sending of the first data to be synchronized to the communication unit fails, the first message also includes a first error code; the computing unit determines whether the first error code carried in the first message is an error code in the first list; if the first error code is in the first list, the computing unit sends the first data to be synchronized to the communication unit again.

[0012] The data synchronization method provided by the embodiment of the present application is applied to a first electronic device, the first electronic device includes a computing unit and a communication unit, in the process of sending the first data to be synchronized to the second electronic device, the computing unit in the first electronic device first determines a first list, wherein the first list includes at least one error code, the error code is used to indicate the failure type when the computing unit fails to send data to the communication unit, then the computing unit sends the first data to be synchronized to the communication unit, and receives a first message returned by the communication unit, the first message is used to indicate whether the sending of the first data to be synchronized to the communication unit is successful, if the first message indicates that the sending of the first data to be synchronized to the communication unit fails, the first message also includes a first error code, the computing unit determines whether the first error code carried in the first message is an error code in the first list, if the first error code is in the first list, the computing unit sends the first data to be synchronized to the communication unit again, because the transmission error indicated by the error code in the first list can usually be solved by re-transmission, so if the first error code is in the first list, the computing unit has a high success rate in sending the first data to be synchronized to the communication unit again.

[0013] In combination with the first aspect, in some embodiments of the first aspect, the number of times the first data to be synchronized is sent to the communication unit is less than a preset threshold.

[0014] When the number of failures of the computing unit in sending the first data to be synchronized to the communication unit exceeds the preset threshold, the probability of data transmission failure between the computing unit and the communication unit again is high. Therefore, when the number of failures of the computing unit in sending the first data to be synchronized to the communication unit exceeds the preset threshold, the computing unit stops sending the first data to be synchronized to the communication unit again, so as to avoid unnecessary data transmission between the computing unit and the communication unit.

[0015] In combination with the first aspect, in certain embodiments of the first aspect, sending first data to be synchronized to a second electronic device includes: sending the first data to be synchronized and first verification information to the second electronic device; receiving second verification information returned by the second electronic device based on the first verification information; determining whether the first data to be synchronized is sent successfully based on the second verification information; if the first data to be synchronized is sent successfully, sending the second data to be synchronized to the second electronic device.

[0016] In combination with the first aspect, in certain embodiments of the first aspect, the first electronic device includes a communication unit and a control unit, and receives second verification information returned by the second electronic device based on the first verification information, including: the communication unit receives the second verification information returned by the second electronic device based on the first verification information; based on the second verification information, determines whether the first data to be synchronized is sent successfully, including: the communication unit sends the second verification information to the control unit; the control unit determines whether the first data to be synchronized is sent successfully based on whether the second verification information matches the first verification information.

[0017] The data synchronization method provided in the embodiment of the present application is applied to a first electronic device, wherein the first electronic device includes a computing unit, a control unit and a communication unit. In the process of the communication unit synchronizing the first data to be synchronized to the second electronic device, the communication unit will synchronously send the first data to be synchronized and the first verification information to the second electronic device, and then the communication unit will receive the second verification information returned by the second electronic device based on the first verification information, and then the communication unit will send the second verification information to the control unit, so that the control unit determines whether the first data to be synchronized is sent successfully based on whether the first verification information and the second verification information match. If the first data to be synchronized is sent successfully, the communication unit sends the second data to be synchronized to the second electronic device, that is, when the first data to be synchronized has not been sent successfully, the data transmission between the first electronic device and the second electronic device is suspended, and only when the first data to be synchronized is synchronized to the second electronic device, the second data to be synchronized is synchronized to the second electronic device, so that the data transmission between the first electronic device and the second electronic device is performed serially, thereby avoiding the transmission confusion caused by the first electronic device and the second electronic device synchronizing multiple data at the same time, thereby avoiding the situation where data cannot be transmitted between the first electronic device and the second electronic device.

[0018] In combination with the first aspect, in certain embodiments of the first aspect, the method also includes: receiving a first operation from a user, the first operation being used to indicate synchronization of data of a first application; obtaining first data to be synchronized in a first application database, including: obtaining the first data to be synchronized in the first application database in response to the first operation.

[0019] In combination with the first aspect, in certain embodiments of the first aspect, at least two applications also include a second application, the first electronic device also includes a second application database corresponding to the second application, the first operation is also used to indicate that data of the second application is not synchronized, and in response to the first operation, first data to be synchronized in the first application database is obtained, including: in response to the first operation, the first data to be synchronized in the first application database is obtained, and the data in the second application database is not obtained.

[0020] The data transmission method provided by the embodiment of the present application is applied to a first electronic device, and the first electronic device is communicatively connected with the second electronic device. The first electronic device runs at least two applications, and the at least two applications include a first application and a second application. The first electronic device includes a first application database corresponding to the first application, and a second application database corresponding to the second application. The method obtains first data to be synchronized in the first application database, which is data corresponding to the first application, and sends the first data to be synchronized to the second electronic device, which is equivalent to data synchronization between the first electronic device and the second electronic device. The synchronized data is the data in the first application database in the first electronic device, so that only the data of the selected application can be synchronized between the first electronic device and the second electronic device, instead of synchronizing all the data in the first electronic device and the second electronic device. Then, the user can select the synchronized application according to their own needs, and the data synchronization is transformed from device-level data synchronization to application-level data synchronization, thereby improving the user experience.

[0021] In a second aspect, a data synchronization method is provided, which is applied to a data synchronization system. The data synchronization system includes a first electronic device as claimed in any one of claims 1 to 8, and a second electronic device.

[0022] In combination with the second aspect, in certain embodiments of the second aspect, the data synchronization system also includes a third electronic device, and the method also includes: the second electronic device synchronizes first data to be synchronized to the third electronic device, where the first data to be synchronized is data corresponding to a first application running in the first electronic device.

[0023] The data synchronization method provided in the embodiment of the present application is applied to a data synchronization system, and the data synchronization system includes a first electronic device, a second electronic device and a third electronic device as shown in the above embodiment. After the first data to be synchronized is synchronized between the first electronic device and the second electronic device, the second electronic device synchronizes the first data to be synchronized to the third electronic device, wherein the first data to be synchronized is data corresponding to a first application running in the first electronic device, so that the first electronic device can synchronize the first data to be synchronized to the third electronic device. It can be understood that the third electronic device can be multiple electronic devices, so it is equivalent to that the first electronic device can synchronize data to multiple electronic devices through the second electronic device, thereby improving the efficiency of synchronizing data.

[0024] In a third aspect, a data synchronization device is provided, comprising a unit for executing any one of the methods in the first aspect or the second aspect. The device may be a server, a terminal device, or a chip in a terminal device. The device may include an input unit and a processing unit.

[0025] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory, which is used to store computer program code. When the processor executes the computer program code stored in the memory, the terminal device executes any one of the methods in the first aspect or the second aspect.

[0026] When the device is a chip in a terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the methods in the first aspect or the second aspect.

[0027] In one possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to execute: obtaining first data to be synchronized in a first application database, the first data to be synchronized is data corresponding to a first application; and sending the first data to be synchronized to a second electronic device.

[0028] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by a data synchronization device, the data synchronization device executes any one of the data synchronization methods in the first aspect or the second aspect.

[0029] In a fifth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by a data synchronization device, the data synchronization device executes any one of the device methods in the first aspect or the second aspect.

[0030] The data synchronization method provided in the embodiment of the present application is applied to a first electronic device, where the first electronic device is communicatively connected with a second electronic device, where the first electronic device runs at least two applications, where the at least two applications include a first application, and where the first electronic device includes a first application database corresponding to the first application. The method obtains first data to be synchronized in the first application database, where the first data to be synchronized is data corresponding to the first application, and sends the first data to be synchronized to the second electronic device, which is equivalent to data synchronization between the first electronic device and the second electronic device, where the synchronized data is data in the first application database in the first electronic device, so that only data of the selected application can be synchronized between the first electronic device and the second electronic device, rather than synchronizing data of all applications in the first electronic device and the second electronic device, so that the user can select the synchronized application according to their own needs, thereby transforming data synchronization from device-level data synchronization to application-level data synchronization, and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1A It is a schematic diagram of the interface for logging into the same account on different electronic devices;

[0032] Figure 1B It is a schematic diagram of an interface for data synchronization between different electronic devices;

[0033] Figure 2 is a schematic diagram of a hardware system of an electronic device applicable to the present application;

[0034] Figure 3A It is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0035] Figure 3B This is a schematic diagram of an interface for selecting an application for synchronization provided in an embodiment of the present application;

[0036] Figure 3C It is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0037] Figure 3D This is a schematic diagram of an interface for synchronizing an application program provided in an embodiment of the present application;

[0038] Figure 3E It is a schematic diagram of another interface for synchronizing application programs provided by an embodiment of the present application;

[0039] Figure 4 This is a schematic diagram of creating a synchronization group provided by an embodiment of the present application;

[0040] Figure 5 is a schematic diagram of a synchronizable database provided in an embodiment of the present application;

[0041] Figure 6 This is a schematic diagram of interaction between an application and a synchronization service provided in an embodiment of the present application;

[0042] Figure 7 is a schematic diagram of a metadata library provided in an embodiment of the present application;

[0043] Figure 8 is a schematic diagram of interaction between a mobile phone and a NAS provided in an embodiment of the present application;

[0044] Fig. 9 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0045] Fig.10 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0046] Fig.11 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0047] Fig.12 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0048] Fig.13 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0049] Fig.14 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0050] Fig.15 It is a schematic diagram of a data synchronization electronic device provided by the present application. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0052] In the following, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", and "third" may explicitly or implicitly include one or more of the features.

[0053] At present, the same user usually owns multiple electronic devices, and the data can be automatically synchronized between the electronic devices.

[0054] For example, Figure 1A As shown, user A logs into account "1111" on smartphone 11, and user A logs into account "1111" on tablet computer PAD 21 at the same time. At this time, user A takes a photo of the snow mountain through smartphone 11, and obtains the photo 101, as shown in FIG. Figure 1B At the same time, the photo 101 in the smart phone 11 can be automatically synchronized to the PAD 21, so that the user A can easily check the photo in the PAD 21. At this time, the photo albums in the smart phone 11 and the PAD 21 both display the photo 101, as shown in FIG. Figure 1B In this case, if there are more than two services that can realize the data synchronization function, for example, both the call service and the gallery service can realize the data synchronization function, the user can only choose to synchronize data for both services, or not synchronize data for both services, which will result in the user being unable to independently select the synchronized service, resulting in a poor user experience.

[0055] In view of this, an embodiment of the present application provides a data synchronization method, which is applied to a first electronic device, wherein the first electronic device is communicatively connected with a second electronic device, the first electronic device runs at least two applications, the at least two applications include a first application, and the first electronic device includes a first application database corresponding to the first application. By obtaining first data to be synchronized in the first application database, the first data to be synchronized is data corresponding to the first application, and the first data to be synchronized is sent to the second electronic device, which is equivalent to data synchronization between the first electronic device and the second electronic device, and the synchronized data is the data in the first application database in the first electronic device, so that only the data of the selected application can be synchronized between the first electronic device and the second electronic device, rather than synchronizing all the data in the first electronic device and the second electronic device, so that the user can select the synchronized application according to their own needs, and the data synchronization is transformed from device-level data synchronization to application-level data synchronization, thereby improving the user experience.

[0056] The data synchronization method provided in the embodiment of the present application can be applied to electronic devices. Optionally, the electronic device includes a terminal device, which can also be called a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The terminal device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc. The embodiment of the present application does not limit the specific technology and specific device form adopted by the terminal device.

[0057] For example, Figure 2 1 shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0058] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0059] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0060] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0061] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0062] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0063] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0064] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0065] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0066] It should be noted that any electronic device mentioned in the embodiments of the present application may include more or fewer modules in the electronic device 100.

[0067] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.

[0068] The application scenarios provided by the embodiments of the present application are described below with reference to the accompanying drawings.

[0069] FIG. 3A to FIG. 3C A schematic diagram of an application scenario of the data synchronization method provided in an embodiment of the present application.

[0070] If user A has both mobile phone 10 and PAD 30, data synchronization between mobile phone 10 and PAD 30 can be performed through a home storage center device (Network Attached Storage, NAS), or directly, which is not limited in the present embodiment. Figure 3A As shown, data synchronization is performed between the mobile phone 10 and the PAD 30 via the NAS 20 .

[0071] It is understandable that there are two applications in the mobile phone 10 that can perform data synchronization, for example, both the gallery application and the call log application can perform data synchronization. User A can select one of the applications for data synchronization, or can select both the gallery application and the call log application for data synchronization, which is not limited in the embodiment of the present application.

[0072] For example, the user logs in to the mobile phone 10 and the PAD 30 through the same account, and data synchronization can be performed between the mobile phone 10 and the PAD 30. Figure 3B As shown, user A selects not to synchronize the gallery and selects to synchronize the call records in the mobile phone 10; selects to synchronize the gallery and selects not to synchronize the call records in the PAD 30.

[0073] If the user takes a photo of the snow mountain through the mobile phone 10, an image 110 is obtained. The image 110 is stored in the photo album of the mobile phone 10, and the image 110 is displayed in the photo album, such as Figure 3CBased on the selection of user A, the mobile phone 10 synchronizes the images in the gallery, and then synchronously displays the image 110 in the album of the PAD 30, as shown in FIG. Figure 3D shown.

[0074] However, since user A chooses not to synchronize call records, user A calls "Xiao A" at the current moment, and the call record of calling "Xiao A" is displayed on the mobile phone 10, but the call record of calling "Xiao A" is not synchronously displayed on the PAD 30, as shown in FIG. Figure 3E shown.

[0075] It should be understood that the above is an example of an application scenario and does not limit the application scenario of the present application.

[0076] Combine the following Figures 4 to 14 The data synchronization method provided in the embodiment of the present application is described in detail.

[0077] First, the process of how electronic devices establish a synchronization group is described.

[0078] When an electronic device is turned on, it usually automatically creates a synchronization group named after its own device ID, and the leader of the synchronization group is the device itself by default.

[0079] For example, Figure 4 As shown, when NAS20 is turned on, the synchronization group manager in the synchronization service process in NAS20 obtains the device ID of NAS20 from the device management service. For example, the device ID of NAS20 is: DEV_ID_OF_NAS. The synchronization group manager creates a synchronization group named DEV_ID_OF_NAS based on the device ID of NAS20, and sets the leader of the synchronization group to NAS20. Then the synchronization group manager creates a corresponding metadata database. Among them, the metadata database is used to store database information with NAS20 as the central database. The structure of the metadata database can adopt the structure of the syncable database SyncableKVDB.

[0080] For example, Figure 5 As shown, Syncable KV DB consists of two parts: business database (data DB) and log database (log DB). Among them, data DB is usually used to persist data and supports reading, writing and querying data, so Data DB is used to store actual business data. And log DB is used to store operation logs. A device in the synchronization group stores logs in log DB, and another device in the synchronization group can reproduce the logs to achieve data synchronization with the database of the above device. It can be said that log DB is the key to achieving data synchronization between different devices.

[0081] The data and data format stored in the log DB can be shown in Table 1.

[0082] Table 1

[0083] max Index Key ${max Index} Index For Devld Synced logs' max Index Index data DB operation log Index data DB operation log Index data DB operation log

[0084] Among them, the max Index Key is used to store the largest operation record Index in the current logDB, and the maxIndex Key will increase as the operation records are generated.

[0085] Index For Devld is used to record the maximum index of synchronized operation records of the other end device in the synchronization group;

[0086] Index: used to mark the order of each operation record. The format of the operation record is shown in Table 2.

[0087] Table 2

[0088] Index 0 key name value jack type add / delete src local / remote status written / not written timestamp 129391

[0089] The key is used to indicate the key of the data corresponding to the operation record.

[0090] Value is used to indicate the value of the data corresponding to the operation record.

[0091] Type is used to indicate the type of operation record, including add and delete.

[0092] The source (src) is used to indicate the source of the data corresponding to the operation record, for example, the data corresponding to the operation record is local data, or the data corresponding to the operation record is data synchronized to the local device by other devices.

[0093] The status is used to indicate whether the operation record has stored the corresponding data. For example, the operation record has been written to the disk, but the specific data item has not been written to the disk; writing to the disk can mean storing it in the database.

[0094] A timestamp refers to the time when the data corresponding to the operation record is generated, and can be represented by the count value of a counter in an electronic device.

[0095] Data is stored in SyncableKVDB based on Leveldb in a KV format, which means data is stored by key and value. Both key and value are arbitrary byte arrays. When storing data, the key value is sorted according to the comparator function specified by the user.

[0096] The following describes the process of how other electronic devices join the synchronization group.

[0097] Continuing to take NAS20 as the leader of the synchronization group as an example, the process of how other electronic devices join the synchronization group is described.

[0098] Other electronic devices may refer to Figure 3A It should be understood that the application process that needs to perform data synchronization in the mobile phone 10 is usually unable to directly interact with the synchronization service process, so the data interaction between the two processes is achieved through the cross-process assisting process.

[0099] For example, Figure 6 As shown in the figure, the call process exchanges data with the synchronization service process through the cross-process assistance process. Usually, the database manager in the call process will create Figure 6 The call record database shown in is used to store call records. Among them, the structure of the call record database can adopt the structure of the above-mentioned Syncable KV DB, and the name of the call record database can be Call Record. The electronic device can specify to synchronize the call data to the synchronization group whose synchronization group name is group Id DEV_ID_OF_NAS, and then the database butler in the call process notifies the synchronization group butler in the synchronization service process through the cross-process assistance process that the call record database has been created. The synchronization group butler searches whether there is a synchronization group with the synchronization group name DEV_ID_OF_NAS in the mobile phone 10. Since the mobile phone 10 has not yet joined the synchronization group DEV_ID_OF_NAS, there is no synchronization group with the synchronization group name DEV_ID_OF_NAS in the mobile phone 10. At this time, the mobile phone needs to create a synchronization group copy with the synchronization group name DEV_ID_OF_NAS. The synchronization group copy can be an empty metadata library and adopt the structure of the above-mentioned Syncable KV DB. After creating the synchronization group copy with the synchronization group name DEV_ID_OF_NAS, the synchronization group copy adds a piece of data 1 to the metadata database in the mobile phone. The data key of data 1 is the name of the call record database established by the call service, that is, CallRecord. The data structure of data 1 can be shown in Table 3.

[0100] Table 3

[0101] ServiceId Phone Call is Auto Sync true bind When Dead false …… ……

[0102] Among them, "ServiceId" is used to indicate the service type of the data, for example, "phone Call" shown in Table 3 indicates that the service type of the stored data is a call service. "is Auto Sync" is used to indicate whether automatic synchronization is performed. If the value of "isAuto Sync" is "true", as shown in Table 3, it means that automatic synchronization is required; if the value of "is Auto Sync" is "false", it means that automatic synchronization is not required. "bind When Dead" indicates whether to automatically initiate a synchronization request when the current process does not exist. For example, the value of "bind When Dead" shown in Table 3 is "false", which means that when the call process does not exist, the synchronization request is not automatically initiated; if the value of "bind When Dead" is "true", it means that when the call process does not exist, the synchronization request is automatically initiated.

[0103] Correspondingly, a piece of data 2 is added to the metadata database of the synchronization group leader NAS20. The added data 2 is as follows: Figure 7 As shown in the figure, a new data 21 is added to the data DB, specifically {Phone Call, true, false}; the log information corresponding to the newly added data 21 in the log DB includes the keys "max Index Key", "Index For NAS" and "0", where the value assigned to "max Index Key" is "0", indicating that data 2 is the first new data in the metadata database; the value assigned to "Index ForNAS" is "-1", indicating that data 2 has not been synchronized to NAS; the value assigned to the key "0" is the detailed information of data 2, including Figure 7 “{0,“call Record”{PhoneCall,true,false},add,local,written,001}” as shown in the figure.

[0104] Thus, the mobile phone 10 has been successfully added to the synchronization group DEV_ID_OF_NAS. When the application in the mobile phone needs to synchronize data to the NAS, the application data (such as call records) is stored in the metadata library in the synchronization service process through the application to be synchronized (such as the call application), and the value of "max Index Key" and the value of "Index For NAS" are updated at the same time.

[0105] After the mobile phone 10 joins the synchronization group DEV_ID_OF_NAS, the mobile phone 10 and the NAS 20 can first synchronize the metadata database in the mobile phone 10 with the metadata database in the NAS 20. Figure 8 and Fig. 9 The illustrated embodiment is described in detail.

[0106] The connection relationship between the units in the edge device (mobile phone 10) and the central device (NAS20) is first described below.

[0107] like Figure 8 As shown, the mobile phone 10 includes a computing unit 101, a storage unit 102, a control unit 103 and a communication unit 104. The NAS 20 includes a computing unit 201, a storage unit 202, a control unit 203 and a communication unit 204. The computing unit 101 is connected to the storage unit 102, the control unit 103 and the communication unit 104 respectively, and the control unit 103 is connected to the communication unit 104. The computing unit 201 in the NAS 20 is connected to the storage unit 202 and the communication unit 204 respectively. The communication unit 104 is connected to the communication unit 204. The data synchronization between the mobile phone 10 and the NAS 20 is performed by data transmission between the communication unit 104 in the mobile phone 10 and the communication unit 204 in the NAS 20.

[0108] Fig. 9 A flowchart of a data synchronization method provided in an embodiment of the present application is shown as follows: Fig. 9 As shown, the method includes:

[0109] S101. A computing unit in a mobile phone 10 determines whether the mobile phone 10 meets a preset condition.

[0110] The preset conditions may include that the temperature of the local device is lower than a preset temperature threshold, the remaining power of the local device is greater than a preset power threshold, and the NAS20 is in a state where it can be connected. The mobile phone 10 meeting the preset conditions may mean that the temperature of the mobile phone 10 is lower than a preset temperature threshold, the remaining power of the mobile phone 10 is greater than a preset power threshold, and the NAS20 is in a state where it can be connected.

[0111] If the mobile phone 10 meets the preset conditions, S102 is executed.

[0112] S102: The computing unit 101 obtains first data.

[0113] If the mobile phone 10 meets the above preset conditions, that is, the temperature of the mobile phone 10 is lower than the preset temperature threshold, the remaining power of the mobile phone 10 is greater than the preset power threshold, and the NAS 20 is in a connectable state, the calculation unit 101 in the mobile phone 10 obtains the first data.

[0114] It should be understood that the first data may refer to data for synchronizing the metadatabase in the mobile phone 10 with the metadatabase in the NAS 20. For example, the first data may be data in the syncMsg field format as shown in Table 4.

[0115] Table 4

[0116] type SYNC_REQUEST_FROM_EDGE last Index -1 db Name meta group ld DEV_ID_OF_NAS request Id 0 sync Data {1,CallRecord,{phone,true,false},156464,ADD}

[0117] The fields indicate:

[0118] Type: used to indicate the message type of the data to be synchronized.

[0119] Last Index: The synchronized Index value. The value of last Index increases as the amount of synchronized data increases.

[0120] Database Name (db Name): indicates the name of the database where the data to be synchronized is currently located. As shown in Table 4, the name of the database is meta, indicating that the data to be synchronized is currently stored in the metadata database in the edge device, that is, the metadata database in the mobile phone 10.

[0121] Synchronization group ID (group Id): the ID of the synchronization group.

[0122] Request ID: refers to the unique ID of the synchronization request.

[0123] Sync Data: This field is used to store the data for this synchronization.

[0124] The calculation unit 101 can obtain the first data by querying the operation log in the log DB of the metadata database in the storage unit 102 in the mobile phone 10. For example, the metadata database includes the fields shown in Table 5. The calculation unit 101 can use the operation record shown in Table 5 as sync Data to generate the first data.

[0125] Table 5

[0126] Index 1 key Call Record value {phone Call,true,false} time stamp 156464 data Type ADD

[0127] Index: used to mark the order of each operation record. For example, the Index in Table 5 is 1, which means that the current operation record is the first operation record in the metadata database.

[0128] key: the key of the data corresponding to the operation record. For example, as shown in Table 5, the value of "key" is "CallRecord", which means that the operation corresponding to the current operation record is to synchronize the call record database.

[0129] value: the value of the data corresponding to the operation record. As shown in Table 5, the value is assigned as: {phone Call, true, false}. It can be understood that when the mobile phone 10 joins the synchronization group DEV_ID_OF_NAS, the data structure synchronized to the metadata can be as shown in Table 3. As shown in Table 3, the first row of data is "ServiceId", which is used to indicate the business type of the data. The first data "phone Call" in value is the assignment of "ServiceId", which means that the data to be synchronized is the call record; the second row of data is "is Auto Sync", which is used to indicate whether to synchronize automatically. The second data "true" in value is the assignment of "is Auto Sync", indicating that automatic synchronization is required; the third row of data is "bind When Dead", which is used to indicate whether to automatically pull up the synchronization request when the current process does not exist. The third data "false" in value is the assignment of "bindWhen Dead", indicating that when the current process does not exist, the synchronization request is not automatically pulled up.

[0130] data Type: the type of operation record, including add and delete. When the value assigned to data Type is add, it indicates that the current operation is to add data; when the value assigned to data Type is delete, it indicates that the current operation is to delete data.

[0131] timestamp: The timestamp when the data corresponding to the operation record is generated.

[0132] S103 . The calculation unit 101 converts the first data in the syncMsg format into the second data in the string format.

[0133] S104 . The computing unit 101 sends the second data in a string format to the communication unit 104 .

[0134] When the computing unit 101 sends the second data to the communication unit 104, a retransmission mechanism may be used to send the second data to the communication unit 104. The retransmission mechanism may refer to: first establishing a retransmission list, which includes multiple error codes. After the computing unit 101 fails to send the second data to the communication unit 104, if the error code returned by the communication unit 104 to the computing unit 101 is in the retransmission list, the computing unit 101 re-sends the second data to the communication unit 104; if the error code returned by the communication unit 104 to the computing unit 101 is not in the retransmission list, the computing unit 101 no longer sends the second data to the communication unit 104. Optionally, if the number of retransmissions exceeds 3 times, the retransmission is stopped.

[0135] It should be noted that the transmission error indicated by the error code in the retransmission list can usually be resolved by retransmission. Therefore, when the error code returned by the communication unit 104 to the computing unit 101 is in the retransmission list, the success rate of the computing unit 101 retransmitting to the communication unit 104 is high.

[0136] S105 . The communication unit 104 sends the second data to the communication unit 204 .

[0137] The communication unit 104 may call the underlying data transmission service to send the second data to the communication unit 204 in the NAS 20 .

[0138] S106 . The computing unit 101 sends a blocking request to the control unit 103 .

[0139] The blocking request is used to indicate the suspension of data transmission between the mobile phone 10 and the NAS 20. The control unit 103 obtains the verification information in the current data to be transmitted (equivalent to the second data), wherein the verification information includes the device identifier request ID of the sending request and the device identifier group ID of the receiving information. As shown in Table 4, the request ID carried in the second data is 0, and the group ID is DEV_ID_OF_NAS. When the mobile phone 10 receives the request returned by the NAS 20 and the request ID carried is 0 and the group ID is DEV_ID_OF_NAS, the control unit 103 releases the blocking.

[0140] Optionally, the control unit 103 may also set a preset duration and suspend the data transmission between the mobile phone 10 and the NAS 20 within the preset duration. For example, after the control unit 103 suspends the data transmission between the mobile phone 10 and the NAS 20, the waiting time exceeds the preset duration, regardless of whether the mobile phone 10 receives the request returned by the NAS 20, and whether the request returned by the NAS 20 carries a request ID of 0 and a group ID of DEV_ID_OF_NAS, the data transmission between the mobile phone 10 and the NAS 20 will be resumed.

[0141] S107 . The communication unit 204 sends the second data to the computing unit 201 .

[0142] S108 , the calculation unit 201 stores the second data in the storage unit 202 .

[0143] The second data is data in string format, and the calculation unit 201 may first convert the second data in string format into third data in syncMsg format. The third data in syncMsg format may be as shown in Table 6, wherein, since the metadata library in NAS20 is not updated, the sync Data in the third data is empty. Furthermore, since the third data has been written into NAS20, that is, the third data is the first data stored in NAS20, the value of last Index is updated from "-1" to "0".

[0144] Table 6

[0145] type SYNC_REQUEST_FROM_EDGE last Index 0 db Name meta group ld DEV_ID_OF_NAS request Id 0 sync Data Null

[0146] Then the computing unit 201 sends the third data to the storage unit 202, and the storage unit 202 writes the third data to the disk.

[0147] In the process of sending the third data to the storage unit 202, the above-mentioned retransmission mechanism is usually adopted. That is, a retransmission list is first established in the computing unit 201, and the retransmission list includes multiple error codes. If the message returned by the storage unit 202 to the computing unit 201 carries the error code in the retransmission list, the computing unit 201 sends the third data to the storage unit 202 again; if the error code carried in the message returned by the storage unit 202 to the computing unit 201 is not the error code in the retransmission list, the computing unit 201 stops sending the third data to the storage unit 202.

[0148] Optionally, the computing unit 201 may further set a maximum number of times of retransmitting the third data to the storage unit 202. For example, the computing unit 201 retransmits the third data to the storage unit 202 no more than three times, that is, the maximum number is three.

[0149] It should be noted that the process of storing data in the storage unit 202 may be referred to as data flushing.

[0150] Exemplarily, the storage unit 202 can generate fourth data in writeBatch format based on the third data in syncMsg format, and write the fourth data in writeBatch format to the disk. It should be understood that the writeBatch format is a data structure used by level DB to implement specific transactions. Each entry in writeBatch records a database operation (for example, inserting a piece of data, or deleting a piece of data), as well as the key and value corresponding to the above database operation. The database operations recorded in writeBatch correspond one-to-one to each record in sync Data.

[0151] Through the above steps, the edge device synchronizes the data to the central device. In a possible case, the central device also returns the fifth data to the edge device. The following is a detailed description through steps S109 to S116.

[0152] S109. The calculation unit 201 obtains fifth data.

[0153] Among them, similar to the calculation unit 101 in the mobile phone 10 obtaining the first data, the calculation unit 201 in the NAS20 can also obtain the fifth data by querying the log DB in the metadata database in the NAS20. The fifth data is also in the syncMsg field format, and the syncMsg field format can be similar to that in Table 4, wherein the "db Name" indicating the source of the data changes from "Meta" to "Center", indicating that the fifth data is data generated from the central device. Among them, the fifth data usually also carries verification information, wherein the verification information includes request Id and group Id. Since the request Id in the verification information carried by the mobile phone 10 to the second data of NAS20 is 0, and the group Id is DEV_ID_OF_NAS, therefore, the request Id in the verification information carried in the fifth data is 0, and the group Id is DEV_ID_OF_NAS.

[0154] S110 , the calculation unit 201 converts the fifth data in the syncMsg format into the sixth data in the string format.

[0155] It is understandable that the calculation unit 201 converts the fifth data in the syncMsg format into the sixth data in the string format without changing the content carried therein. For example, the verification information request ID carried in the fifth data is 0, and the group ID is DEV_ID_OF_NAS, and the verification information request ID is 0, and the group ID is DEV_ID_OF_NAS is also carried in the sixth data.

[0156] S111 . The computing unit 201 sends sixth data in a string format to the communication unit 204 .

[0157] It can be understood that when the computing unit 201 sends the sixth data to the communication unit 204, a retransmission mechanism can also be adopted.

[0158] After the calculation unit 201 fails to send the sixth data to the communication unit 204, if the error code returned by the communication unit 204 to the calculation unit 201 is in the retransmission list, the calculation unit 201 re-sends the sixth data to the communication unit 204; if the error code returned by the communication unit 204 to the calculation unit 201 is not in the retransmission list, the calculation unit 201 no longer sends the sixth data to the communication unit 204. Optionally, if the number of retransmissions exceeds 3 times, the retransmission is stopped.

[0159] S112 . The communication unit 204 sends sixth data to the communication unit 104 .

[0160] The communication unit 204 may call the underlying data transmission service to send the sixth data to the communication unit 104 in the mobile phone 10 .

[0161] S113 . The communication unit 104 sends sixth data to the control unit 103 .

[0162] S114. The control unit 103 verifies the sixth data.

[0163] Verifying the sixth data may indicate comparing the verification information request Id and group Id carried by the sixth data with the verification information request Id and group Id carried in the second data; if the verification information request Id and group Id carried by the sixth data are the same as the verification information carried in the second data, the verification passes.

[0164] For example, the verification information request Id carried in the sixth data is 0, and the group Id is DEV_ID_OF_NAS, and the verification information request Id carried in the second data is 0, and the group Id is DEV_ID_OF_NAS, then the verification information request Id and group Id carried in the sixth data are the same as the verification information carried in the second data, and the verification passes.

[0165] If the control unit 103 verifies the sixth data and finds that it passes, step S115 is executed.

[0166] S115. The control unit 103 sends a request to release the blocking to the computing unit 101.

[0167] S116 . The calculation unit 101 stores the sixth data in the storage unit 102 .

[0168] It is understandable that when the computing unit 101 stores the sixth data in the storage unit 102 , it may first convert the sixth data in the syncMsg format into the seventh data in the writeBatch format, and then store the seventh data in the writeBatch format in the storage unit 102 .

[0169] After the metadata database in the mobile phone 10 is synchronized with the metadata database in the NAS 20, the database of the application in the mobile phone 10 can be synchronized with the database of the application in the NAS 20, thereby realizing data synchronization of the application. Fig.10 Let me explain in detail.

[0170] like Fig.10 As shown, a data synchronization method provided in an embodiment of the present application includes:

[0171] S201. A computing unit in the mobile phone 10 determines whether the mobile phone 10 meets a preset condition.

[0172] If the mobile phone 10 meets the preset conditions, S22 is executed.

[0173] S202. The calculation unit 101 obtains eighth data.

[0174] It should be understood that the eighth data may refer to data in the application database in the mobile phone 10 that needs to be synchronized to the NAS 20. For example, the eighth data may be in the syncMsg field format as shown in Table 7.

[0175] Table 7

[0176] type SYNC_REQUEST_FROM_EDGE last Index -1 db Name CallRecord group ld DEV_ID_OF_NAS request Id 0 sync Data {1,key1,value1,156464,ADD}

[0177] It should be noted that, unlike the synchronization metadata database, the data source of the synchronization application is the application database, e.g. Figure 6 Therefore, the database name of the data to be synchronized is obtained as "CallRecord", which is different from the database name db Name in the first data as "meta".

[0178] In addition, the sync Data in the eighth data is also different from the first data. As shown in Table 6, when synchronizing the data of the application, the sync Data includes "{1, key1, value1, 156464, ADD}", where value1 indicates specific data, such as indicating the operation record of calling Xiao A.

[0179] S203 . The calculation unit 101 converts the eighth data in the syncMsg format into the ninth data in the string format.

[0180] S204 . The computing unit 101 sends the ninth data in the format of string to the communication unit 104 .

[0181] S205 . The communication unit 104 sends the ninth data to the communication unit 204 .

[0182] The communication unit 104 may call the underlying data transmission service to send the second data to the communication unit 204 in the NAS 20 .

[0183] S206 . The computing unit 101 sends a blocking request to the control unit 103 .

[0184] It can be understood that the process of the computing unit 101 sending the eighth data to the communication unit 204 in the NAS 20 through the communication unit 104 is similar to the steps shown in S103 to S106, and will not be repeated here.

[0185] S207 . The communication unit 204 sends ninth data to the calculation unit 201 .

[0186] S208 . The calculation unit 201 stores the ninth data in the storage unit 202 .

[0187] The ninth data is data in string format, and the calculation unit 201 may first convert the ninth data in string format into the tenth data in syncMsg format. The tenth data in syncMsg format may be as shown in Table 8, wherein, since there is no change in the call record database in NAS20, the sync Data in the tenth data is empty. Furthermore, since the tenth data has been written into the call record database in NAS20, that is, the tenth data is the first data stored in NAS20, the value of last Index is updated from "-1" to "0".

[0188] Table 8

[0189] type SYNC_REQUEST_FROM_EDGE last Index 0 db Name CallRecord group ld DEV_ID_OF_NAS request Id 0 sync Data Null

[0190] Then the calculation unit 201 generates the eleventh data in the writeBatch format according to the tenth data in the syncMsg format. It should be understood that the writeBatch format is a data structure used by level DB to implement specific transactions. Each entry in writeBatch records a database operation (for example, inserting a piece of data, or deleting a piece of data), as well as the key and value corresponding to the above database operation. The database operations recorded in writeBatch correspond one-to-one to each record in sync Data.

[0191] Through the above steps, the edge device synchronizes the data in the application database to the central device.

[0192] It is understandable that after completing data synchronization of the application database between the mobile phone 10 and the NAS 20 , the NAS 20 may synchronize the synchronized data to another edge device, such as the PAD 30 , thereby achieving data synchronization of the application between the mobile phone 10 and the PAD 30 .

[0193] The process by which NAS 20 can synchronize data in the application database to PAD 30 is similar to Fig.10 The embodiments shown are similar and will not be described again here.

[0194] Fig.11 A flowchart of a data synchronization method provided in an embodiment of the present application is shown as follows: Fig.11 As shown, the method is applied to a first electronic device, the first electronic device is communicatively connected with a second electronic device, the first electronic device runs at least two applications, the at least two applications include a first application, the first electronic device includes a first application database corresponding to the first application, and the method includes:

[0195] S301. Acquire first data to be synchronized in a first application database, where the first data to be synchronized is data corresponding to a first application program.

[0196] The first data to be synchronized may include: Fig.10 The eighth data in the embodiment shown. It should be noted that, Fig.10 In the illustrated embodiment, after the first electronic device obtains the eighth data, the ninth data obtained by format conversion of the eighth data can also be the first data to be synchronized. It should be understood that the eighth data and the ninth data include the same content, but only in different formats.

[0197] S302: Send first data to be synchronized to the second electronic device.

[0198] The first data to be synchronized sent to the second electronic device may include: Fig.10 The ninth data in the illustrated embodiment.

[0199] Fig.11 The implementation principle of the embodiment shown is the same as that of the above Figures 4 to 10 The embodiments shown are similar and will not be described again here.

[0200] The data synchronization method provided in the embodiment of the present application is applied to a first electronic device, and the first electronic device is communicatively connected with a second electronic device. The first electronic device runs at least two applications, and the at least two applications include a first application. The first electronic device includes a first application database corresponding to the first application. The first data to be synchronized is obtained from the first application database, and the first data to be synchronized is data corresponding to the first application. The first data to be synchronized is sent to the second electronic device, which is equivalent to data synchronization between the first electronic device and the second electronic device. The synchronized data is the data in the first application database in the first electronic device, so that only the data of one of the applications can be synchronized between the first electronic device and the second electronic device, instead of synchronizing all the data in the first electronic device and the second electronic device. Then, the user can select the synchronized application according to their own needs, and the data synchronization is transformed from device-level data synchronization to application-level data synchronization, thereby improving the user experience.

[0201] In one embodiment, the first electronic device includes a computing unit and a communication unit, such as Fig.12 As shown, the method includes:

[0202] S401. A computing unit obtains first data to be synchronized in a first application database.

[0203] S402: The computing unit sends first data to be synchronized to the communication unit.

[0204] A possible implementation of S402 “the computing unit sends the first data to be synchronized to the communication unit” includes:

[0205] S4021. The computing unit determines a first list, where the first list includes at least one error code, and the error code is used to indicate a failure type when the computing unit fails to send data to the communication unit.

[0206] The first list may be the retransmission list shown in the above embodiment. The transmission error indicated by the error code included in the retransmission list can usually be resolved by retransmission.

[0207] S4022. The computing unit sends first data to be synchronized to the communication unit.

[0208] S4023. The communication unit returns a first message to the computing unit, where the first message is used to indicate whether sending the first data to be synchronized to the communication unit is successful.

[0209] If the first message indicates that sending the first data to be synchronized to the communication unit fails, the first message also includes a first error code.

[0210] S4024. The calculation unit determines whether the first error code carried in the first message is an error code in the first list.

[0211] S4025: If the first error code is in the first list, the computing unit sends the first data to be synchronized to the communication unit again.

[0212] The data synchronization method provided by the embodiment of the present application is applied to a first electronic device, the first electronic device includes a computing unit and a communication unit, in the process of sending the first data to be synchronized to the second electronic device, the computing unit in the first electronic device first determines a first list, wherein the first list includes at least one error code, the error code is used to indicate the failure type when the computing unit fails to send data to the communication unit, then the computing unit sends the first data to be synchronized to the communication unit, and receives a first message returned by the communication unit, the first message is used to indicate whether the sending of the first data to be synchronized to the communication unit is successful, if the first message indicates that the sending of the first data to be synchronized to the communication unit fails, the first message also includes a first error code, the computing unit determines whether the first error code carried in the first message is an error code in the first list, if the first error code is in the first list, the computing unit sends the first data to be synchronized to the communication unit again, because the transmission error indicated by the error code in the first list can usually be solved by re-transmission, so if the first error code is in the first list, the computing unit has a high success rate in sending the first data to be synchronized to the communication unit again.

[0213] Optionally, the number of times the first data to be synchronized is sent to the communication unit is less than a preset threshold.

[0214] Exemplarily, the preset threshold may be 3 times.

[0215] When the number of failures of the computing unit in sending the first data to be synchronized to the communication unit exceeds the preset threshold, the probability of data transmission failure between the computing unit and the communication unit again is high. Therefore, when the number of failures of the computing unit in sending the first data to be synchronized to the communication unit exceeds the preset threshold, the computing unit stops sending the first data to be synchronized to the communication unit again, so as to avoid unnecessary data transmission between the computing unit and the communication unit.

[0216] S403: The communication unit sends first data to be synchronized to the second electronic device.

[0217] Fig.12 The implementation principle of the embodiment shown is the same as that of the above Figures 4 to 10 The embodiments shown are similar and will not be described again here.

[0218] Fig.13A flow chart of another data synchronization method provided in an embodiment of the present application is provided. The method is applied to a first electronic device, and the first electronic device includes a computing unit, a control unit, and a communication unit. Fig.13 As shown, the method includes:

[0219] S501: A computing unit obtains first data to be synchronized in a first application database.

[0220] S502: The computing unit sends first data to be synchronized to the communication unit.

[0221] A possible implementation of S502 “the computing unit sends the first data to be synchronized to the communication unit” includes:

[0222] S5021. The computing unit determines a first list, where the first list includes at least one error code, and the error code is used to indicate a failure type when the computing unit fails to send data to the communication unit.

[0223] The first list may be the retransmission list shown in the above embodiment. The transmission error indicated by the error code included in the retransmission list can usually be resolved by retransmission.

[0224] S5022. The computing unit sends first data to be synchronized to the communication unit.

[0225] S5023. The communication unit returns a first message to the computing unit, where the first message is used to indicate whether sending the first data to be synchronized to the communication unit is successful.

[0226] If the first message indicates that sending the first data to be synchronized to the communication unit fails, the first message also includes a first error code.

[0227] S5024. The calculation unit determines whether the first error code carried in the first message is an error code in the first list.

[0228] S5025: If the first error code is in the first list, the computing unit sends the first data to be synchronized to the communication unit again.

[0229] Optionally, the number of times the first data to be synchronized is sent to the communication unit is less than a preset threshold.

[0230] S503: The communication unit sends first data to be synchronized and first verification information to the second electronic device.

[0231] S504: The second electronic device returns second verification information to the communication unit based on the first verification information.

[0232] S505: The communication unit sends second verification information to the control unit.

[0233] S506: The control unit determines whether the first data to be synchronized is sent successfully based on whether the second verification information matches the first verification information.

[0234] If the first data to be synchronized is sent successfully, execute S507.

[0235] S507: The communication unit sends second data to be synchronized to the second electronic device.

[0236] The second data to be synchronized may be data in the first application database or data in the second application database, which is not limited in this embodiment of the present application.

[0237] For example, the first data to be synchronized is the call record of the user making a call at time T0, and the second data to be synchronized may be the call record of the user making a call at time T1. Both the first data to be synchronized and the second data to be synchronized are data in the first application database (call application database) corresponding to the first application (call application).

[0238] For another example, the first data to be synchronized is the call record of the user at time T0. At time T1, the user turns off the automatic synchronization of calls and turns on the automatic synchronization of gallery. At this time, the second data to be synchronized can be the picture data updated by the gallery at time T2, that is, the data updated in the gallery database corresponding to the gallery application. Among them, time T0 is earlier than time T1, and time T1 is earlier than time T2.

[0239] Fig.13 The implementation principle of the embodiment shown is the same as that of the above Figures 4 to 10 The embodiments shown are similar and will not be described again here.

[0240] The data synchronization method provided in the embodiment of the present application is applied to a first electronic device, wherein the first electronic device includes a computing unit, a control unit and a communication unit. In the process of the communication unit synchronizing the first data to be synchronized to the second electronic device, the communication unit will synchronously send the first data to be synchronized and the first verification information to the second electronic device, and then the communication unit will receive the second verification information returned by the second electronic device based on the first verification information, and then the communication unit will send the second verification information to the control unit, so that the control unit determines whether the first data to be synchronized is sent successfully based on whether the first verification information and the second verification information match. If the first data to be synchronized is sent successfully, the communication unit sends the second data to be synchronized to the second electronic device, that is, when the first data to be synchronized has not been sent successfully, the data transmission between the first electronic device and the second electronic device is suspended, and only when the first data to be synchronized is synchronized to the second electronic device, the second data to be synchronized is synchronized to the second electronic device, so that the data transmission between the first electronic device and the second electronic device is performed serially, thereby avoiding the transmission confusion caused by the first electronic device and the second electronic device synchronizing multiple data at the same time, thereby avoiding the situation where data cannot be transmitted between the first electronic device and the second electronic device.

[0241] Fig.14 A flow chart of another data synchronization method provided in an embodiment of the present application, the method is applied to a first electronic device, the first electronic device is communicatively connected with a second electronic device, the first electronic device runs at least two applications, the at least two applications include a first application and a second application, the first electronic device includes a first application database corresponding to the first application, and a second application database corresponding to the second application, such as Fig.14 As shown, the method includes:

[0242] S601: Receive a first operation from a user, where the first operation is used to instruct synchronization of data of a first application.

[0243] The first operation may refer to an operation of selecting to synchronize the first application.

[0244] For example, Figure 3B As shown, the first application may be a call application, the second application may be a gallery application, and the first operation may be an operation of turning on an automatic synchronization call record control in the mobile phone 10 .

[0245] Optionally, the first operation may also be used to indicate not to synchronize data of the second application.

[0246] For example, Figure 3BAs shown, the first application may be a call application, the second application may be a gallery application, and the first operation may be an operation of turning on the automatic synchronization of call record controls in the mobile phone 10 while turning off the automatic synchronization of the gallery.

[0247] S602: In response to the first operation, obtain first data to be synchronized in the first application database, where the first data to be synchronized is data corresponding to the first application program.

[0248] Optionally, in response to the first operation, first data to be synchronized in the first application database is obtained, and data in the second application database is not obtained.

[0249] S603: Send first data to be synchronized to the second electronic device.

[0250] Fig.14 The implementation principle of the embodiment shown is the same as that of the above Figures 4 to 10 The embodiments shown are similar and will not be described again here.

[0251] The data transmission method provided by the embodiment of the present application is applied to a first electronic device, and the first electronic device is communicatively connected with the second electronic device. The first electronic device runs at least two applications, and the at least two applications include a first application and a second application. The first electronic device includes a first application database corresponding to the first application, and a second application database corresponding to the second application. The method obtains first data to be synchronized in the first application database, which is data corresponding to the first application, and sends the first data to be synchronized to the second electronic device, which is equivalent to data synchronization between the first electronic device and the second electronic device. The synchronized data is the data in the first application database in the first electronic device, so that only the data of the selected application can be synchronized between the first electronic device and the second electronic device, instead of synchronizing all the data in the first electronic device and the second electronic device. Then, the user can select the synchronized application according to their own needs, and the data synchronization is transformed from device-level data synchronization to application-level data synchronization, thereby improving the user experience.

[0252] In one embodiment, a data synchronization method is provided. The method is applied to a data synchronization system. The data synchronization system includes a first electronic device and a second electronic device as shown in the above embodiment.

[0253] Optionally, the data synchronization system also includes a third electronic device. After the first data to be synchronized is synchronized between the first electronic device and the second electronic device, the second electronic device synchronizes the first data to be synchronized to the third electronic device, where the first data to be synchronized is data corresponding to the first application running in the first electronic device.

[0254] It can be understood that the third electronic device can be multiple electronic devices.

[0255] The implementation principle of the above embodiment is Figures 4 to 10 The embodiments shown are similar and will not be described again here.

[0256] The data synchronization method provided in the embodiment of the present application is applied to a data synchronization system, and the data synchronization system includes a first electronic device, a second electronic device and a third electronic device as shown in the above embodiment. After the first data to be synchronized is synchronized between the first electronic device and the second electronic device, the second electronic device synchronizes the first data to be synchronized to the third electronic device, wherein the first data to be synchronized is data corresponding to a first application running in the first electronic device, so that the first electronic device can synchronize the first data to be synchronized to the third electronic device. It can be understood that the third electronic device can be multiple electronic devices, so it is equivalent to that the first electronic device can synchronize data to multiple electronic devices through the second electronic device, thereby improving the efficiency of synchronizing data.

[0257] It should be understood that, although each step in the flow chart in the above-described embodiment is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is clear explanation in this article, the execution of these steps does not have strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0258] It is understandable that in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.

[0259] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one module. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. It should be noted that the names of the modules in the embodiment of the present application are schematic and are not limited to the names of the modules in actual implementation.

[0260] Fig.15 A structural schematic diagram of an electronic device provided by the present application is shown. Fig.15 The dotted line in the figure indicates that the unit or the module is optional. The electronic device 700 can be used to implement the data synchronization method described in the above method embodiment.

[0261] The electronic device 700 includes one or more processors 701, which can support the electronic device 700 to implement the data synchronization method in the method embodiment. The processor 701 can be a general-purpose processor or a special-purpose processor. For example, the processor 701 can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, such as discrete gates, transistor logic devices or discrete hardware components.

[0262] The processor 701 may be used to control the electronic device 700, execute software programs, and process data of the software programs. The electronic device 700 may also include a communication unit 705 to implement input (reception) and output (transmission) of signals.

[0263] For example, the electronic device 700 may be a chip, the communication unit 705 may be an input and / or output circuit of the chip, or the communication unit 705 may be a communication interface of the chip, and the chip may be a component of a terminal device or other electronic devices.

[0264] For another example, the electronic device 700 may be a terminal device, and the communication unit 705 may be a transceiver of the terminal device, or the communication unit 705 may be a transceiver circuit of the terminal device.

[0265] The electronic device 700 may include one or more memories 702 on which a program 704 is stored. The program 704 can be executed by the processor 701 to generate instructions 703, so that the processor 701 executes the impedance matching method described in the above method embodiment according to the instructions 703.

[0266] Optionally, data may be stored in the memory 702. Optionally, the processor 701 may read data stored in the memory 702. The data may be stored at the same storage address as the program 704, or may be stored at a different storage address than the program 704.

[0267] The processor 701 and the memory 702 may be provided separately or integrated together; for example, integrated on a system on chip (SOC) of a terminal device.

[0268] Exemplarily, the memory 702 can be used to store the related program 704 of the data synchronization method provided in the embodiment of the present application, and the processor 701 can be used to call the related program 704 of the data synchronization method stored in the memory 702 when performing data synchronization, and execute the data synchronization method of the embodiment of the present application; including: obtaining the first data to be synchronized in the first application database, the first data to be synchronized is the data corresponding to the first application; sending the first data to be synchronized to the second electronic device.

[0269] The present application also provides a computer program product, which, when executed by the processor 701, implements the data synchronization method described in any method embodiment of the present application.

[0270] The computer program product may be stored in the memory 702 , for example, a program 704 , which is converted into an executable target file that can be executed by the processor 701 after preprocessing, compiling, assembling, and linking.

[0271] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the data synchronization method described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.

[0272] The computer-readable storage medium is, for example, a memory 702. The memory 702 may be a volatile memory or a nonvolatile memory, or the memory 702 may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0273] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0274] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0275] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0276] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0277] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0278] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0279] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0280] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A data synchronization method, It is characterized in that The method is applied to a first electronic device, the first electronic device is communicatively connected with a second electronic device, the first electronic device runs at least two applications, the at least two applications include a first application, and the first electronic device includes a first application database corresponding to the first application, the method includes: Acquire first data to be synchronized in the first application database, where the first data to be synchronized is data corresponding to the first application program; The first data to be synchronized is sent to the second electronic device.

2. The method according to claim 1, It is characterized in that The first electronic device includes a computing unit and a communication unit, and the acquiring the first data to be synchronized in the first application database includes: The computing unit acquires the first data to be synchronized in the first application database; The sending the first to-be-synchronized data to the second electronic device includes: The computing unit sends the first data to be synchronized to the communication unit; The communication unit sends the first data to be synchronized to the second electronic device.

3. The method according to claim 2, It is characterized in that The computing unit sends the first data to be synchronized to the communication unit, comprising: The computing unit determines a first list, wherein the first list includes at least one error code, and the error code is used to indicate a failure type when the computing unit fails to send data to the communication unit; The computing unit sends the first data to be synchronized to the communication unit, and receives a first message returned by the communication unit, where the first message is used to indicate whether the first data to be synchronized is successfully sent to the communication unit; If the first message indicates that sending the first data to be synchronized to the communication unit fails, the first message also includes a first error code; The calculation unit determines whether the first error code carried in the first message is an error code in the first list; If the first error code is in the first list, the computing unit sends the first data to be synchronized to the communication unit again.

4. The method according to claim 3, It is characterized in that The number of times the first data to be synchronized is sent to the communication unit is less than a preset threshold.

5. The method according to any one of claims 1 to 4, It is characterized in that The sending the first to-be-synchronized data to the second electronic device includes: Sending the first data to be synchronized and the first verification information to the second electronic device; The method further comprises: Receiving second verification information returned by the second electronic device based on the first verification information; Determine whether the first data to be synchronized is sent successfully based on the second verification information; If the first data to be synchronized is sent successfully, the second data to be synchronized is sent to the second electronic device.

6. The method according to claim 5, It is characterized in that The first electronic device includes a communication unit and a control unit, and the receiving second verification information returned by the second electronic device based on the first verification information includes: The communication unit receives second verification information returned by the second electronic device based on the first verification information; The determining whether the first data to be synchronized is sent successfully based on the second verification information includes: The communication unit sends the second verification information to the control unit; The control unit determines whether the first data to be synchronized is sent successfully based on whether the second verification information matches the first verification information.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: receiving a first operation of a user, where the first operation is used to instruct synchronization of data of the first application; The acquiring the first data to be synchronized in the first application database includes: In response to the first operation, first data to be synchronized in the first application database is obtained.

8. The method according to claim 7, It is characterized in that The at least two applications further include a second application, the first electronic device further includes a second application database corresponding to the second application, the first operation is further used to indicate not to synchronize data of the second application, and in response to the first operation, obtaining first data to be synchronized in the first application database includes: In response to the first operation, first data to be synchronized in the first application database is obtained, and data in the second application database is not obtained.

9. A data synchronization method, It is characterized in that The method is applied to a data synchronization system, which includes a first electronic device as claimed in any one of claims 1 to 8, and a second electronic device.

10. The method according to claim 9, It is characterized in that The data synchronization system further includes a third electronic device, and the method further includes: The second electronic device synchronizes first data to be synchronized with the third electronic device, where the first data to be synchronized is data corresponding to a first application running in the first electronic device.

11. An electronic device, It is characterized in that The electronic device comprises a module for executing the method according to any one of claims 1-8.

12. An electronic device, It is characterized in that include: one or more processors; Memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device executes the method according to any one of claims 1 to 8.

13. A chip system, It is characterized in that The chip system includes a processor for calling and running a computer program from a memory, so that an electronic device equipped with the chip system executes the method according to any one of claims 1 to 8.

14. A computer-readable storage medium comprising a computer program, It is characterized in that When the computer program is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Synchronization of data in a distributed computing environment

    CN103155477A

  • Data synchronization management method and system and electronic equipment

    CN116166740A