Data Transmission Method, System, Device and Medium
By obtaining and writing target data to generate databases that meet different operating systems and creating backup packages, the problem of Line chat records migrating between iOS and Android devices is solved, and a simple, secure and stable data migration process is achieved.
Patent Information
- Application Number
- CN202111616256.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Line chat records cannot be directly migrated between iOS and Android devices, resulting in low user experience. The existing solutions have problems such as long, complex processes, low success rates and poor compatibility.
By obtaining the target data of the first terminal, including contact information and a chat database, writing it to the chat database, generating a new database that complies with the rules of the second terminal database, and creating a backup package, adding it to the backup package, data migration across the operating system is realized.
It realizes simple, safe, stable and fast migration of Line chat records between different operating system devices, with strong compatibility and is not affected by version updates.
Smart Images

Figure CN114385589B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a data transmission method, system, device and medium. Background Art
[0002] Line app is a free instant messaging software developed and launched by Line Corporation under South Korea in 2011, and has a large user group in Taiwan of China, Japan and Thailand.
[0003] Since the storage methods of Line chat record backup data are different in iOS system and Android system, the Line backup data of iOS users and Android users cannot be directly migrated. And Line does not provide a cross-terminal transmission tool between iOS and Android. Currently, the chat backup data of Line users are stored on third-party Google Drive or Apple iCloud cloud storage services.
[0004] In the help of Line's official website, it is clearly introduced that it is impossible to restore chat records between devices of different operating systems (Android to iPhone, iPhone to Android). The available backup and restoration methods of chat records are only for iOS users to use iCloud backup restoration, and Android users to use Google Drive to backup chat records. This results in the inability to directly migrate the Line backup data between iOS users and Android users. If a Line user replaces the old device with a new device and the operating systems of the new and old devices are different, the data cannot be migrated, and the chat records on the old device cannot be synchronized to the new device, resulting in a poor user experience. Summary of the Invention
[0005] In view of the above-mentioned disadvantages of the prior art, the present invention provides a data transmission method, system, device and medium to solve the technical problem that Line chat records cannot be transmitted and migrated between devices of different operating systems and the user experience is poor.
[0006] A data transmission method provided by the present invention includes:
[0007] Obtain target data of a target application in a first terminal, where the target data includes contact information, group information and a chat database;
[0008] Write the contact information and group information into the chat database;
[0009] Obtain a database rule of the target application in a second terminal, and generate a new database according to the database rule and the chat database written with the contact information and group information;
[0010] Create a backup package for the second terminal, add the newly added database to the backup package, and the backup package is used for backup and restoration of the second terminal to implement transmission of the target data from the first terminal to the second terminal, where the operating systems of the first terminal and the second terminal are different.
[0011] Optionally, the target data further includes attachments. Before performing backup and restoration of the second terminal based on the backup package, the method further includes:
[0012] Obtain chat records from the chat database storing the contact information and group information, and determine the attachment location path of the attachments in the chat records;
[0013] Obtain the attachment storage path of the target application in the second terminal;
[0014] Store the attachments into the second terminal according to the attachment storage path and the attachment location path.
[0015] Optionally, the method for obtaining the contact information of the target application in the first terminal includes:
[0016] Construct an authorization request QR code, which is used to be scanned by the target application in the first terminal for data acquisition authorization;
[0017] If the authorization is successful, obtain the contact identifier of the target application in the first terminal;
[0018] Obtain the contact information of each contact according to the contact identifier, where the contact information includes at least one of the contact's mobile Internet device, name, creation time, avatar data, etc.
[0019] Optionally, the method for constructing the QR code includes:
[0020] Send a session creation request message to the server of the target application, and obtain a session creation response message, where the session creation response message includes application authentication QR code data;
[0021] Send a QR code creation request message to the server of the target application, and obtain a QR code creation response message, where the QR code creation response message includes the application authentication QR code data and the uniform resource locator of the hypertext transfer protocol;
[0022] Obtain a pairing key, where the pairing key includes a public key and a private key, and encode the public key to obtain a sensitive data parameter;
[0023] Generate a uniform resource locator (URL) for a QR code based on a preset version number, the sensitive data parameter, the application authentication QR code data, and the URL of the Hypertext Transfer Protocol.
[0024] Generate the QR code based on the URL of the QR code.
[0025] Optionally, if the authorization is successful, before obtaining the contact identifier of the target application in the first terminal, the method further includes:
[0026] Send a QR code authentication confirmation request message to the server of the target application and obtain a QR code authentication confirmation response message, where the QR code authentication confirmation response message includes authentication success or authentication failure.
[0027] If the QR code authentication confirmation response message includes authentication success, send a personal identification number (PIN) creation request message to the server of the target application and obtain a PIN creation request response message, where the PIN creation request response message includes a PIN.
[0028] Send the PIN to the target application in the first terminal. If the target application in the first terminal successfully verifies the PIN, send a PIN authentication verification message to the target application in the first terminal, where the PIN authentication verification message is used to verify whether the authorization of the first terminal is successful.
[0029] Optionally, obtaining the chat database of the target application in the first terminal includes:
[0030] Back up the chat database of the target application in the first terminal to a target storage space.
[0031] Obtain the target account identification information of the target data, and obtain the chat database from the target storage space according to the target account identification information.
[0032] The present invention also provides a data transmission system, where the system includes:
[0033] A data acquisition module, configured to acquire target data of a target application in a first terminal, where the target data includes contact information, group information, and a chat database.
[0034] A writing module, configured to write the contact information and group information into the chat database.
[0035] A generation module, configured to obtain a database rule of the target application in a second terminal, and generate a new database according to the database rule and the chat database written with the contact information and group information.
[0036] A creation module for creating a backup package of the second terminal, adding the newly added database to the backup package, where the backup package is used to perform backup and restoration on the second terminal to achieve the transfer of the target data from the first terminal to the second terminal, where the operating systems of the first terminal and the second terminal are different.
[0037] Optionally, the system further includes at least one of the following:
[0038] A driver detection module for detecting the driver of the target operating system in the data transfer system before the data acquisition module acquires the target data of the target application in the first terminal. If the driver is missing or the version is lower than the latest version, install the latest version of the driver of the target operating system for the data transfer system, where the target operating system includes the operating system of the first terminal and the operating system of the second terminal;
[0039] An unlocking and trust detection module for detecting whether both the first terminal and the second terminal have completed unlocking and trust before the data acquisition module acquires the target data of the target application in the first terminal. If unlocking and / or trust have not been completed, prompt for unlocking and / or trust authorization;
[0040] A data backup module for backing up the chat database of the target application in the first terminal to the target storage space.
[0041] The present invention also provides an electronic device, including a processor, a memory, and a communication bus;
[0042] The communication bus is used to connect the processor and the memory;
[0043] The processor is configured to execute the computer program stored in the memory to implement the method described in any one of the above embodiments.
[0044] The present invention also provides a computer-readable storage medium, on which a computer program is stored,
[0045] The computer program is used to cause the computer to execute the method described in any one of the above embodiments.
[0046] Advantages of the present invention: A data transmission method, system, device and medium provided by the present invention. The method obtains target data including a chat database, contact information and group information in a first terminal, writes the group information and contact information into the chat database, obtains a database rule of the target application in a second terminal, generates a new database according to the database rule and the chat database written with contact information and group information, creates a backup package of the second terminal, and adds the new database to the backup package, and performs backup and restoration on the second terminal through the backup package, so as to realize the transmission of the target data from the first terminal to the second terminal. Based on this method, Line chat records can be migrated between devices of different operating systems, and the process is simple, highly compatible, not affected by version updates, and the data transplantation is safer, more stable and faster. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 FIG. is a flowchart of a data transmission method provided by an embodiment of the present invention;
[0048] Figure 2 FIG. is a specific flowchart of a data transmission method provided by an embodiment of the present invention;
[0049] Figure 3 FIG. is a structural diagram of a data transmission system provided by an embodiment of the present invention;
[0050] Figure 4 FIG. is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] The present invention provides a data transmission method and related devices. To make the purpose, technical solution and effects of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0052] Those skilled in the art can understand that, unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present invention means the presence of the stated features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups. It should be understood that when we say that an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any unit and all combinations of one or more of the associated listed items.
[0053] Those skilled in the art can understand that, unless otherwise defined, all terms used herein (including technical terms and scientific terms) have the same meaning as the general understanding of those of ordinary skill in the art to which the present invention pertains. It should also be understood that terms such as those defined in a general dictionary should be understood to have a meaning consistent with the meaning in the context of the prior art, and will not be interpreted with an idealized or overly formal meaning unless specifically defined as here.
[0054] It should be noted that the following application scenarios are only shown for the convenience of understanding the present invention, and the embodiments of the present invention are not limited in this regard. On the contrary, the embodiments of the present invention can be applied to any applicable scenario.
[0055] The inventor has found through research that the Line app does not support the migration of chat records between devices of different operating systems, resulting in a low user experience. The transmission and migration of chat records for different operating systems can be achieved by reducing the backup and restoration of the Line app. Specifically, by first downgrading the app version, invoking the Android adb backup function to back up the user data of Line, parsing the database and attachments in the backup, and then converting them into a database that conforms to the iOS version, and constructing an iOS backup to restore to the iOS device. It can also be achieved by decompiling the Line app to obtain the smali code, adding custom code, copying the chat record database to the SD card directory accessible by adb through the custom code, and then copying the database and attachments to the PC for database conversion and constructing an iOS backup to restore to the iOS device.
[0056] The solution of downgrading and backing up and restoring by installing an older version of the app is as follows. First, it is necessary to check whether Line has been installed. If it has been installed, the existing Line needs to be uninstalled, and the older version of Line included with the solution needs to be installed. This may cause the automatic deletion of the user's existing data if Line is directly uninstalled. Additionally, the installed older version of the app cannot be opened and used because it is too old. Moreover, the installation of the app requires the invocation of adb commands. Currently, due to the chaos in the Android app market and the existence of some rogue apps, mobile phone manufacturers have strengthened the restrictions on the installation of external apps. Some models limit the installation of third-party apps, resulting in an increased failure rate of installation. Even if the installation is successful, the adb backup command needs to be invoked to back up Android data. Currently, for security reasons, some models like Huawei devices require encrypted backups. After the backup, a decryption process is also required, making the process more complex. At the same time, adb backup has been phased out by Android, and mainstream and latest apps do not support the adb version. Therefore, only older versions of apps support it. If users need to continue using the Line app on Android later, they need to upgrade it to the latest version of Line by themselves, which is inconvenient to operate. The entire process is long, complex, and has a low success rate.
[0057] The solution of decompiling and modifying the original Line software to add data copy code is as follows. First, it is necessary to check whether Line has been installed. If the user has installed the Line app, the existing Line app must be forcibly uninstalled, and the custom-modified version of Line needs to be installed. This also poses a risk of deleting existing data if Line is directly uninstalled. At the same time, since the Line app is decompiled and the code is modified, the existing signature is damaged. To pass the Android installation check, a custom signature is added, which results in the user using a pirated app, posing legal risks and the problem that the subsequent pirated app cannot be upgraded to the latest Line. Additionally, the invocation of the adb installation command is required to install an untrusted third-party app, reducing the success rate. Moreover, since Line releases new versions regularly, the old version cannot be logged in after a certain period of time. Therefore, regular maintenance is required, and custom modifications need to be made based on the latest version. The compatibility is poor.
[0058] It can be seen that both of the above two solutions have defects such as low security, long process, high risk, and poor compatibility.
[0059] To solve the above problems, the following further describes the inventive concept by describing the embodiments in conjunction with the accompanying drawings.
[0060] As Figure 1 shown, this embodiment provides a data transmission method, which includes:
[0061] Step S101: Obtain the target data of the target application in the first terminal.
[0062] Among them, the target data includes contact information, group information, and a chat database.
[0063] The target applications in the first terminal and the following second terminal are the same application, such as instant messaging applications like Line.
[0064] The target application in the first terminal may include one or more accounts. In other words, the user of the first terminal can log in and use one or more accounts based on the target application of the first terminal. At this time, the data of each account can be stored in a manner known to those skilled in the art. When obtaining the target data subsequently, the data corresponding to the required account can be obtained as the target data based on the account identification information of the account (such as ID, UID, account name, etc.).
[0065] Optionally, the target data can be the data of one account or the data of multiple accounts.
[0066] The chat database includes the data stored by the target application in the first terminal. The chat database includes chat records of the target application, etc.
[0067] In one embodiment, the method for obtaining the contact information of the target application in the first terminal includes:
[0068] Construct an authorization request QR code, which is used to be scanned by the target application in the first terminal for data acquisition authorization;
[0069] If the authorization is successful, obtain the contact identifier of the target application in the first terminal;
[0070] Obtain the contact information of each contact according to the contact identifier. The contact information includes at least one of the contact's mobile Internet device, name, creation time, avatar data, etc.
[0071] Optionally, the method for constructing the QR code includes:
[0072] Send a session creation request message to the server of the target application and obtain a session creation response message. The session creation response message includes the application authentication QR code data;
[0073] Send a QR code creation request message to the server of the target application and obtain a QR code creation response message. The QR code creation response message includes the application authentication QR code data and the uniform resource locator of the hypertext transfer protocol;
[0074] Obtain a pairing key, which includes a public key and a private key. Encode the public key to obtain sensitive data parameters;
[0075] Generate a uniform resource locator (URL) for the QR code based on a preset version number, sensitive data parameters, application authentication QR code data, and the URL of the Hypertext Transfer Protocol;
[0076] Generate a QR code based on the URL of the QR code.
[0077] Before sending a session creation request message to the server of the target application, the method further includes:
[0078] Construct a first request header. Optionally, the first request header includes at least one of a request name, a simulated client type, a version number, a request method, a connection type, a protocol type, a region, and a reception type. For example, the request name is x-Line-application, the simulated client type is ChromeOS, the version number is 2.4.1, the set request method x-lhm is POST, the connection type content-type is application / x-thrift, the protocol type protocol = TBINARY, the region x-lal is set to the region abbreviation zh., and the reception type accept is set to application / x-thrift;
[0079] Generate a key. Optionally, the key can be generated by generating a number of byte data through random numbers, etc. The key is used for subsequent encryption and decryption of data. For example, generate 16-byte data as the key data (key) through random numbers, and the key data is used to participate in sending encrypted data and decrypting received data later;
[0080] Construct communication data. Optionally, the communication data includes at least one of a tag character and encrypted data. Optionally, the communication data x-cls is the encrypted key sent to communicate with the Line server, the tag data is 0005, and the encrypted data is encrypted data in Base64 format;
[0081] Send the communication data to the Line server to inform the Line server to use the key for encrypted and decrypted communication later.
[0082] Optionally, the request data is encrypted data. The encrypted data can use the public key certificate of Line to perform RSA asymmetric encryption on the previously randomly generated 16-byte key data (key), and obtain the encrypted data for Base64 encoding.
[0083] In one embodiment, the generation method of the session creation request message includes:
[0084] The construction session creation sends data and specifies a request path. The session creation send data includes a tag header and a command. Optionally, the tag header is x-lpqs, whose value is / acct / lgn / sq / v1, and the command is createSession. The request path can be the concatenation of the x-lpqs string and its corresponding value / acct / lgn / sq / v1createSession, and the createSession string, that is, x-lpqs + / acct / lgn / sq / v1createSession + createSession;
[0085] Construct a session creation encrypted data packet and calculate the size value of the session creation encrypted data packet. Optionally, the construction method of the session creation encrypted data packet can be a symmetric encryption algorithm in the AES CBC mode (it can also be other modes, taking this mode as an example here) to encrypt this string (the above request path), and use the PKCS7 algorithm (it can also be other algorithms known to those skilled in the art) to supplement and pad the data. The encryption key involved is the previously randomly generated 16-byte key data (secret key). After encryption, XXHASH algorithm (it can also be implemented by other algorithms known to those skilled in the art) is performed on the AES encrypted data through Xxhash32. The obtained data is used as the session creation encrypted data packet of the session creation request message command and recorded at the end of the encrypted data. The size value of this session creation encrypted data packet can be set as x-cl as the size value of the session creation encrypted data packet;
[0086] Generate a session creation request message based on the above first request header, communication data, session creation encrypted data packet size value, and session creation encrypted data packet. Optionally, use the first request header (x-Line-application, accept, content-type, x-lhm, x-lal), communication data x-lcs, and session creation encrypted data packet size value x-cl of the session creation request message as the first request header to send a Post request, where the POST data is the session creation encrypted data packet.
[0087] Optionally, when the target application is Line, the URL of the target application's server is as follows:
[0088] https: / / gf.Line.naver.jp / enc.
[0089] Optionally, send a session creation request message to the server of the target application. If the session creation request message is successfully sent, a session creation response message will be obtained. The session creation response message includes response header data and a response data packet. A preset successful response code (such as 200, etc.) can be preset. Parse the response header data, which includes x-cl. Determine whether x-cl is equal to the preset response code (such as 200, etc.). If it is equal, the command is successfully sent; otherwise, the command sending fails. When the command is successfully sent, decrypt the response data packet. Taking the response data packet as binary encrypted data as an example, the encrypted data can be padded to a multiple of 16 using methods such as PKCS7. After padding, use the AES CBC mode algorithm to decrypt the data. After decryption, use methods such as PKCS7 UnPadding to remove the padded data after decryption, and finally obtain 66 bytes containing a string starting with SQ, where the 64-byte data after the SQ character is a numeric string. This numeric string represents the data for the authentication QR code to be applied for. Those skilled in the art can also implement the above data decryption and data padding methods using other known methods.
[0090] In one embodiment, after obtaining the data for the authentication QR code application, that is, the session application is successful. After the session application is successful, send a QR code creation request message to the server of the target application.
[0091] Optionally, the generation method of the QR code creation request message includes:
[0092] Construct the QR code creation and sending data. Among them, the QR code creation and sending data includes a label header, a command, and data. Optionally, the label header can be data including x-lpqs and / acct / lgn / sq / v1. The command is the string createQrCode, and the data is the numeric string starting with SQ obtained previously (data for the authentication QR code application). One type of QR code creation and sending data is x-lpqs+ / acct / lgn / sq / v1+createQrCode+SQ data (data for the authentication QR code application);
[0093] Construct a QR code to create an encrypted data packet and calculate the size value of the QR code created encrypted data packet. Optionally, the construction method of the QR code created encrypted data packet can be to encrypt this string (the data sent when creating the QR code) through the algorithm of the AES CBC mode, and use the PKCS7 algorithm to supplement and pad the data. The encryption key participating is the 16-byte key data (secret key) randomly generated before. The encrypted data still performs a HASH verification algorithm on the AES encrypted data through Xxhash32. The obtained data is used as the QR code created encrypted data packet and recorded at the end of the encrypted data. Similarly, recalculate the size of the entire data and set it to x-cl (update x-cl with the size value of the QR code created encrypted data packet) as the size value of the QR code created encrypted data packet;
[0094] Generate a QR code creation request message according to the above first request header, communication data, size value of the QR code created encrypted data packet, and the QR code created encrypted data packet. Optionally, use the first request header (x-Line-application, accept, content-type, x-lhm, x-lal), communication data x-lcs, and size value of the QR code created encrypted data packet x-cl as the first request header of the QR code creation request message, and send a Post request. Among them, the POST data is the QR code created encrypted data packet including the createQrCode command.
[0095] Optionally, send the QR code creation request message to the server of the target application. If the QR code creation request message is sent successfully, a QR code creation response message will be obtained. The QR code creation response message includes response header data and a response data packet. A successful preset response code (such as 200, etc.) can be preset. Parse the response header data. The response header data includes x-cl. Judge whether x-cl is equal to the preset response code (such as 200, etc.). If it is equal, the command is sent successfully; otherwise, the command is sent failed. When the command is sent successfully, decrypt the response data packet. Taking the response data packet as binary encrypted data as an example, the encrypted data can be padded according to multiples of 16 using methods such as PKCS7. After padding, use the algorithm of the AES CBC mode to decrypt the data. After decryption, use methods such as PKCS7 UnPadding to remove the padded data after decryption. Finally, a url starting with https: / / Line.me / R / au / q / + the string starting with SQ obtained before (that is, the application authentication QR code data and the uniform resource locator of the hypertext transfer protocol) is obtained. Those skilled in the art can also use other known methods to implement the above data decryption and data padding methods.
[0096] Optionally, the pairing key can be generated by pairing keys based on a preset algorithm to obtain a public key and a private key. For example, the Curve X25519 algorithm is used to pair key (keypair) to obtain the public key key and the private key key.
[0097] Optionally, after encoding the public key, the way to determine the sensitive data parameter can be to perform 64-bit encoding and URLEncode encoding on the public key, and the value obtained after encoding is assigned to secret.
[0098] Optionally, the preset version number can be set to 1 or other values preset by those skilled in the art.
[0099] An example of generating the QR code's Uniform Resource Locator according to the preset version number, sensitive data parameter, application authentication QR code data, and the Uniform Resource Locator of the Hypertext Transfer Protocol is as follows:
[0100] The Uniform Resource Locator of the Hypertext Transfer Protocol (https: / / Line.me / R / au / q / ) in the above QR code creation response message, the application authentication QR code data (SQ + 64-byte data) in the above session creation response message, the sensitive data parameter secret (the value obtained after 64-bit encoding and URLEncode encoding of the public key), and the preset version number e2eeVersion form the QR code URL. An example of a QR code URL is as follows:
[0101] https: / / Line.me / R / au / q / SQ465a54517068417962305a7731797330774c5a37594a3559626e585542375831?secret=PC6UuAh%2B7DM%2B5MXizXk3EIdF2BXiTPiTlUcOPRsmNBE%3D&e2eeVersion=1.
[0102] Generate a QR code based on the Uniform Resource Locator of the QR code, that is, generate a QR code image based on the URL. The specific generation method of the QR code image can be implemented based on the methods known to those skilled in the art and will not be limited here.
[0103] Optionally, the target application in the first terminal can scan the QR code to authorize the acquisition of the application data in the first terminal. Still taking Line as an example, the user scans the QR code in the line app to authorize a third party to obtain its corresponding data.
[0104] In one embodiment, if the authorization is successful, before obtaining the contact identifier of the target application in the first terminal, the method further includes checking whether the QR code is authenticated. Specifically, the method further includes:
[0105] Sending a QR code authentication confirmation request message to the server of the target application and obtaining a QR code authentication confirmation response message, where the QR code authentication confirmation response message includes authentication success or authentication failure;
[0106] If the QR code authentication confirmation response message includes authentication success, sending a personal identification number creation request message to the server of the target application and obtaining a personal identification number creation request response message, where the personal identification number creation request response message includes a personal identification number;
[0107] Sending the personal identification number to the target application in the first terminal. If the target application in the first terminal successfully verifies the personal identification number, sending a personal identification number authentication verification message to the target application in the first terminal, where the personal identification number authentication verification message is used to verify whether the first terminal is successfully authorized.
[0108] Optionally, the generation method of the QR code authentication confirmation request message includes:
[0109] Constructing QR code authentication sending data, where the QR code authentication sending data includes a tag header, a command, and data. At this time, there are two tag headers. Taking the target application as Line as an example, one is X-Line-Access and the corresponding 66-byte SQ string (application authentication QR code data) before, and the other is the string data of x-lpqs and / acct / lgn / sq / v1. The command is verifyCertificate, and the data is the SQ string (application authentication QR code data). That is, the QR code authentication sending data is X-Line-Access + SQ + x-lpqs + / acct / lgn / sq / v1 + verifyCertificate + SQ, where SQ here is the application authentication QR code data (SQ string);
[0110] Construct a QR code authentication encrypted data packet and calculate the size value of the QR code authentication encrypted data packet. Optionally, the construction method of the QR code authentication encrypted data packet can be to encrypt the string (QR code authentication sending data) through the algorithm of the AES CBC mode (it can also be other modes, taking this mode as an example here), and use the PKCS7 algorithm (it can also be other algorithms known to those skilled in the art) to supplement and fill the data. The encryption key is the previously randomly generated 16-byte key data (secret key). The encrypted data still performs a HASH verification algorithm (it can also be implemented by other algorithms known to those skilled in the art) on the AES-encrypted data through Xxhash32. The obtained data is used as the QR code authentication encrypted data packet and recorded at the end of the encrypted data. Similarly, recalculate the size of the entire QR code authentication encrypted data packet, and set its QR code authentication encrypted data packet size value to x-cl (update x-cl with the QR code authentication encrypted data packet size value) as the size value of the QR code authentication encrypted data packet.
[0111] Generate a QR code authentication request message based on the above first request header, communication data, QR code authentication encrypted data packet size value, and QR code authentication encrypted data packet. Optionally, use the first request header (x-Line-application, accept, content-type, x-lhm, x-lal), communication data x-lcs, and QR code authentication encrypted data packet size value x-cl as the first request header of the QR code authentication request message, and send a Post request. Among them, the POST data is the QR code authentication encrypted data packet containing the verifyCertificate command.
[0112] Optionally, after sending the QR code authentication confirmation request message to the server of the target application, wait until the target application in the first terminal scans the code successfully. After the Post returns a result (QR code authentication confirmation response message), send the personal identification code creation request message createPinCode command in sequence, and receive the personal identification code creation request response message. This personal identification code creation request response message includes the personal identification code (pin code). The user passes a 5-digit (it can also be a preset number of digits such as 6, 7, etc.) Pin verification code to the target application such as the Line app in the first terminal. After the Pin code verification is successful, then execute the personal identification code authentication verification message checkPinCodeVerified command to verify whether the device is normally authorized. After the authorization is successful.
[0113] In one embodiment, if the authorization is successful, obtaining the contact identifier of the target application in the first terminal includes:
[0114] Send a contact identifier acquisition message to obtain the contact identifier feedback by the first terminal;
[0115] Send a contact information acquisition message, which includes a contact identifier, and obtain the contact information fed back by the first terminal. The contact information is in an encrypted state, and decrypt the above encrypted contact information to obtain at least one of the contact's mobile Internet device, name, creation time, avatar data, etc.
[0116] For example, send the getAllContactIds command (contact identifier acquisition message) to obtain the ids (contact identifiers) of all contacts, and then through the ids, send the getContacts (contact information acquisition message) to obtain the command for all information of a single contact, and decrypt to obtain the corresponding contact mid (contact's mobile Internet device), name, creation time, avatar data and other information.
[0117] Optionally, the way to obtain group information can be implemented by calling the getGroups method or other ways known to those skilled in the art.
[0118] In one embodiment, obtaining the chat database of the target application in the first terminal includes:
[0119] Back up the chat database of the target application in the first terminal to the target storage space;
[0120] Obtain the target account identification information of the target data, and obtain the chat database from the target storage space according to the target account identification information.
[0121] Optionally, taking the first terminal equipped with the Android system as an example, the target storage space can be the GoogleDrive (Google Cloud Storage) login authorization to access the Line space. Backing up the chat database of the target application in the first terminal to the target storage space includes:
[0122] Obtain the Google service login token, obtain the Google Cloud Storage Line space access permission according to the Google service login token, and then request to obtain the pre-backup Line chat database in the Google Cloud Storage Line space.
[0123] Since the Google Cloud Storage Line space may store the chat databases of multiple Line accounts, the chat database can be obtained from the Google Cloud Storage Line space by obtaining the account identification information (id) of the required account and according to the account identification information.
[0124] Optionally, the Google service login token can be obtained by constructing payload data (data of the payload), sending a token acquisition request message to the Google server, and obtaining a feedback token acquisition feedback message, which includes the Google service login token. For example, set the first Payload to use the SSL protocol, but the encryption algorithm can use the default algorithm or the configured algorithm configured by those skilled in the art. Construct the data of the first payload, send a Post request, and obtain the token data (Google service login token) from https: / / android.clients.google.com / auth. One way to construct the data of the payload is as follows:
[0125] Set "accountType" to "HOSTED_OR_GOOGLE", set the Email to the user's gmail email, set "device_country" to "us", set "operatorCountry" to "us", set the language of "lang" to "en", set "source" to "Android", set "androidId" to a 16-byte random number, and set the sdk version to 17. "EncryptedPasswd" is the encrypted data encoded by base64, which is generated by using the Google public key to perform the RSA encryption algorithm on the Google account and password;
[0126] Send the first payload data to the Google server to send a token authentication request message for authentication. If the authentication is successful, a token authentication feedback message can be received, which includes the token data (Google service login token).
[0127] Optionally, the method for obtaining access rights to the Google Drive Line space includes:
[0128] Set the second Payload to use the SSL protocol, but the encryption algorithm can be the default algorithm or the configured algorithm configured by those skilled in the art. Construct the data of the second payload, send a Post request, and obtain the token data (Google service login token) from https: / / android.clients.google.com / auth. One way to construct the data of the second payload is as follows:
[0129] The Email sets the user's Gmail email, the device_country is set to us, the operatorCountry is set to us, the lang voice is set to en, the androidId is a random number with a length of 16 digits, the google_play_services_version is 212621022, the sdk_version is 25, the client_sig and callerSig are random numbers with a length of 42 digits, the service is set to oauth2:https: / / www.googleapis.com / auth / drive.appdata, and oauth2 authentication is used. The app and callerPkg are set to the app id of line, jp.naver.line.android, and the token is set to the token value (Google service login token) obtained from the previous Google login authentication.
[0130] Send the second payload data to the Google server to send a user authentication request message for authentication. If the authentication is successful, a user authentication feedback message can be received, and this user authentication feedback message includes Auth character data.
[0131] Optionally, a Get request can be sent through Auth to obtain the data space of Line stored in GoogleDrive.
[0132] Optionally, obtaining the chat database from the target storage space according to the target account identification information includes:
[0133] Obtain the account association information stored in the target storage space, and this account association information includes at least one of the stored account identification information, the stored account name, the stored data packet size, and the stored data creation time;
[0134] Obtain the chat database from the target storage space according to the target account identification information.
[0135] Specifically, an exemplary method for obtaining the chat database from the target storage space according to the target account identification information includes:
[0136] Construct a third request header. The user-agent of the third request header is set to LINE Google-API-Java-ClientGoogle-HTTP-Java-Client / 1.28.0(gzip), the x-goog-api-client is set to java / 0.0.0http-google-a / 1.26.0linux / 3.18.48, and the Authorization is set to Bearer + the previously obtained Auth value;
[0137] After constructing the third request header data, send a GET request to the URL https: / / www.googleapis.com / drive / v3 / files?fields=files(id,%20name,%20size,%20createdTime)&orderBy=createdTime&spaces=appDataFolder;
[0138] After the successful sending, obtain the account id (storage account identification information) of Line in the Google Drive space (Google Cloud Drive Line space) storage, the account name name (storage account name), the data packet size size (storage data packet size), and the data packet creation time createTime (storage data creation time).
[0139] It should be noted that there may be multiple different Line accounts in the Google Drive space (Google Cloud Drive Line space) storage.
[0140] One way to request to download the storage space data of the corresponding Line account in Google Drive is:
[0141] The requested URL is "https: / / www.googleapis.com / download / drive / v3 / files / " + the previously obtained id of line (target account identification information) + "?alt=media";
[0142] The request header is still the third request header constructed previously. At this time, the third request header user-agent, x-goog-api-client, and Authorization are set to Bearer + the previously obtained Auth value;
[0143] After the successful sending, obtain the GZIP compressed data packet, and after decompressing it through the decompression algorithm, obtain the chat database of line.
[0144] Step S102: Write the contact information and group information into the chat database.
[0145] Optionally, writing the contact information and group information into the chat database includes:
[0146] Add a contact table and a group table in the chat database, write the contact information into the contact table, and write the group information into the group table.
[0147] The implementation of writing contact information and group information into the chat database can also be to create a new database and transfer all the contact information, group information, and data in the chat database to the new database.
[0148] The implementation of writing contact information and group information into the chat database can also be achieved by other methods known to those skilled in the art.
[0149] Among them, the obtained chat database can be an sqlite database. Create a contacts table in the sqlite database. The table structure includes data such as m_id, name, picture_path, updated_time, created_time, etc. Write the contact information into the sqlite database (taking the target application as Line as an example, write the corresponding information (contact information) obtained by scanning the Line code on the first terminal into the database).
[0150] Similarly, create a groups table in the sqlite database. The table structure includes data such as id, name, picture_status, updated_time, created_time, invitation_enabled, can_add_member_as_friend, can_invite_by_ticket, etc. Write the group information into the database (taking the target application as Line as an example, write the corresponding information obtained by scanning the Line code before into the database).
[0151] Step S103: Obtain the database rules of the target application in the second terminal, and generate a new database based on the database rules and the chat database written with contact information and group information.
[0152] Optionally, this step S103 includes:
[0153] Establish a new database that conforms to the database rules of the target application in the second terminal;
[0154] Read the database data in the chat database written with contact information and group information. This database data includes group information, contact information, and the sending content and time of session chat records and attachments;
[0155] Write the database data into the new database to generate a new database that includes the target application information of the first terminal and conforms to the database rules of the target application in the second terminal.
[0156] Step S104: Create a backup package for the second terminal and add the new database to the backup package.
[0157] The backup package is used to back up and restore the second terminal to achieve the transmission of target data from the first terminal to the second terminal. The first terminal and the second terminal have different operating systems.
[0158] Optionally, the operating system of the first terminal is an Android operating system, and the operating system of the second terminal is an iOS operating system. The first terminal and the second terminal may be the same physical entity or different physical entities.
[0159] Optionally, the backup package can be created by obtaining at least one of the device model, device name, serial number, operating system version number, etc. of the second terminal to create a backup package of the second terminal. The method of adding the new database to the backup package can be implemented in a manner known to those skilled in the art.
[0160] The method of backing up and restoring the second terminal using the backup package can also be implemented in a manner known to those skilled in the art. For example, the backup package can be restored to the device by calling the backup and restoration service interface of the second device. After the restoration is completed, the chat data has been written to the storage location of the target application of the second terminal. After the second terminal starts the target application and logs in to the account corresponding to the target account identification information, the data will be loaded normally.
[0161] In one embodiment, the target data also includes attachments, and before backing up and restoring the second terminal based on the backup package, the method further includes:
[0162] Obtaining a chat record from a chat database having contact information and group information written therein, and determining an attachment location path of the attachment in the chat record;
[0163] Obtaining a storage path for attachments of a target application in a second terminal;
[0164] The attachment is stored in the second terminal according to the attachment storage path and the attachment location path.
[0165] Optionally, before backing up and restoring the second terminal based on the backup package, the method further includes:
[0166] Add attachments to the backup package.
[0167] Optionally, the attachment includes at least one of a picture, a video, an audio, a file, etc.
[0168] Optional ways to obtain attachments include:
[0169] Through the adb command, attachments can be obtained. For example, the default storage path of the attachments of the target application in the first device can be obtained and then obtained by copying based on this default storage path. Taking the target application as Line for example, the default storage path can be / sdcard / android / data / jp.naver.Line.android / files / chats.
[0170] The attachment location path can be determined through chat records, and the specific determination method can be implemented in a manner known to those skilled in the art.
[0171] For example, taking the operating system of the second terminal as the iOS system and the target application as Line for example, the above sqlite database contains complete conversation data, as well as contact information and group information. The data in this database is not encrypted, and the group, contact information, as well as the sending content and time of the session chat records and attachments can be directly read. Create a new database named Line.sqlite (newly added database), and establish tables such as ZCHAT, ZGROUP, ZMESSAGE, ZCHAT that correspond to the content of the iOS Line chat database table. And write the parsed database content into the corresponding tables of the new database (newly added database). Store the attachment path (attachment location path) in the chat records according to the relative path of the iOS Line attachment (attachment storage path) Library / Application Support / PrivateStore / P_account mid / Message Attachments.
[0172] Another example, taking the operating system of the second terminal as the iOS system and the target application as Line for example, from the iOS device (the second terminal), obtain relevant information including device model, device name, serial number, iOS version number, create an iOS backup package for the corresponding device, and add the newly added database and attachments to the backup package in sequence. Log in to the line app on the iOS device. After successful login, start the backup and restore service built into the iOS device itself, call the restore service interface, and restore the iOS backup package to the device. After the restoration is completed, at this time, the chat data has been written to the storage location of the app, and the data will be normally loaded after starting the line app.
[0173] In one embodiment, before obtaining the target data of the target application in the first terminal, the method further includes:
[0174] Install the latest version driver of the first terminal operating system and the latest version driver of the second terminal operating system respectively;
[0175] Obtain the unlocking and trust of the first terminal and the unlocking and trust of the second terminal respectively.
[0176] Among them, the driver is used to identify the hardware of the first terminal and the second terminal and communicate. Unlocking and trust are used to obtain the read and write permissions of the first terminal and to enable the backup service of the second terminal.
[0177] Optionally, taking the operating system of the first terminal as the Android system and the operating system of the second terminal as the iOS system as an example, it can be pre-judged whether there are iOS and Android drivers under the current system. If not, install the latest version of the driver to prepare for iOS and Android hardware identification and communication;
[0178] After connecting the first terminal and the second terminal, judge whether the device is unlocked and trusted. If it is not unlocked and trusted, first let the user unlock the lock screen password and perform trust authorization to prepare for obtaining the read and write permissions of the Android SD card device and enabling the backup service on the iOS side.
[0179] In one embodiment, taking the operating system of the first terminal as the Android system as an example, before obtaining the target data of the target application in the first terminal, the method further includes:
[0180] Guide the original Android device (the first terminal) to back up the data (chat database) to the LineApp space storage (the target storage space) of Google drive.
[0181] The following takes the Android device with the operating system of the first terminal as the Android system, the iOS device with the operating system of the second terminal as the iOS system, and the target application as the line app as an example. Refer to Figure 2 , Figure 2 A specific data transmission method is given. The specific method includes:
[0182] Step S10: Guide to connect and identify the iOS device and the Android device and back up the line data.
[0183] Among them, the line data is the data in the Android device, and the backup can be realized by guiding the Android device to back up the chat database to the line app space storage of Google drive. Optionally, here the iOS device and the Android device can be identified by connecting through a PC.
[0184] Step S20: Construct and generate a line authorization QR code, and scan the code for authorization to obtain contact and group information.
[0185] Among them, scan the Line authorization QR code through the Line app on the Android device to obtain data access authorization, so as to obtain contact information and group information from the Android device.
[0186] Step S30: Construct a Google Drive request to log in and authorize access to the Line space and download the Line database.
[0187] Here, the Line space is the target storage space, that is, the Line app space of Google Drive.
[0188] Here, the Line database is also the chat database.
[0189] Since the target storage space may store databases of multiple accounts, the corresponding chat database can be obtained according to the account ID at this time.
[0190] Step S40: Write the contact information and group information into the session database, and copy the attachments of the Android Line to the PC.
[0191] It should be noted that the session database is also the chat database.
[0192] Copying the attachments of the Android Line to the PC also means copying the attachments of the Line app on the Android device to a storage medium such as a computer.
[0193] It should be noted that the PC can also be replaced by other terminals or servers.
[0194] Step S50: Convert the database into data block files and attachments suitable for the iOS version.
[0195] The database here is also the chat database written with the contact information and group information mentioned above.
[0196] The specific conversion method can refer to the generation method of the above-mentioned new database, and a new database can be obtained through conversion.
[0197] Step S60: Construct an iOS backup package containing Line data and restore the backup to the device.
[0198] In other words, construct an iOS backup package including the above-mentioned new database and attachments, and call the backup restoration interface built in the iOS device to migrate the Line data in the Android device to the iOS device.
[0199] The above embodiments provide a data transmission method. This method obtains target data of a target application in a first terminal, including a chat database, contact information, and group information, writes the group information and contact information into the chat database, obtains the database rules of the target application in a second terminal, generates a new database based on the database rules and the chat database written with contact information and group information, creates a backup package for the second terminal, and adds the new database to the backup package. The second terminal is backed up and restored through the backup package to implement the transmission of the target data from the first terminal to the second terminal. Based on this method, Line chat records can be migrated between devices of different operating systems, with a simple process, strong compatibility, not affected by version updates, and safer, more stable, and faster data transplantation.
[0200] Optionally, to migrate the Line app data (target data) of an Android device (first terminal) to an iOS device (second terminal). By constructing a GoogleDrive request to log in and authorize access to the Line space, obtain the chat database corresponding to the Line account, construct and generate a Line authorization QR code, obtain the contact and group information of Line by scanning the code for authorization through the Line app, write the contact and group information into the chat database, convert the chat database into an iOS database, construct and create an iOS backup, and restore the data to the iOS device. After the login account is restored, the data is migrated and imported normally. This solution can quickly and conveniently solve the problem of data transmission from an Android device of Line to an iOS device. This solution does not require installing an app, uninstalling an app, or calling a backup or encrypting the backup of Android data, and the process is simpler. It has stronger compatibility, is not affected by version updates, and data transplantation is safer, more stable, and faster. It does not require installing a third-party app, uninstalling the original Line app, or calling adb to restore Android data, and the process is simpler. It has stronger compatibility, is not affected by Line version updates, and solves the mutual transmission and migration of Line chat records between Android and iOS devices.
[0201] Using the method provided in this embodiment, the migration of Line chat records can be directly performed by logging in and authorizing access to the Google Drive space for reading and writing, constructing and generating a Line authorization QR code to obtain information, and merging and converting contact groups and chat information. Only network access is required, without the need to root the device, install additional apps, uninstall apps, or restore Android data, and the process is simpler and more stable. It has stronger compatibility, is not affected by version updates, and supports the latest Android system and the latest Line version.
[0202] Based on the above data transmission method, an embodiment of the present invention provides a data transmission system. Refer to Figure 3 , the data transmission system 300 includes:
[0203] A data acquisition module 301, configured to acquire target data of a target application in a first terminal, where the target data includes contact information, group information, and a chat database;
[0204] A writing module 302, configured to write the contact information and the group information into the chat database;
[0205] A generating module 303, configured to acquire a database rule of a target application in a second terminal, and generate an additional database according to the database rule and the chat database written with the contact information and the group information;
[0206] A creating module 304, configured to create a backup package of the second terminal, add the additional database to the backup package, and the backup package is used for backup and restoration of the second terminal, so as to implement transmission of the target data from the first terminal to the second terminal, where the operating systems of the first terminal and the second terminal are different.
[0207] Optionally, the system further includes at least one of the following:
[0208] A driver detection module, configured to detect a driver of a target operating system in the data transmission system before the data acquisition module acquires the target data of the target application in the first terminal. If the driver is missing or the version is lower than the latest version, install the latest version of the driver of the target operating system for the data transmission system, where the target operating system includes the operating system of the first terminal and the operating system of the second terminal;
[0209] An unlocking and trust detection module, configured to detect whether both the first terminal and the second terminal have completed unlocking and trust before the data acquisition module acquires the target data of the target application in the first terminal. If unlocking and / or trust have not been completed, prompt for unlocking and / or trust authorization;
[0210] A data backup module, configured to back up the chat database of the target application in the first terminal to a target storage space.
[0211] Optionally, the target data further includes attachments, and the system further includes an attachment migration module, configured to:
[0212] Before performing backup and restoration of the second terminal based on the backup package, acquire chat records from the chat database written with the contact information and the group information, and determine the attachment location path of the attachments in the chat records;
[0213] Acquire the attachment storage path of the target application in the second terminal;
[0214] Store the attachment into the second terminal according to the attachment storage path and the attachment location path.
[0215] Optionally, the data acquisition module includes a contact information acquisition module for:
[0216] Construct an authorization request QR code, which is used to be scanned by the target application in the first terminal for data acquisition authorization;
[0217] If the authorization is successful, obtain the contact identifier of the target application in the first terminal;
[0218] Obtain the contact information of each contact according to the contact identifier. The contact information includes at least one of the contact's mobile Internet device, name, creation time, avatar data, etc.
[0219] Optionally, the construction method of the QR code includes:
[0220] Send a session creation request message to the server of the target application and obtain a session creation response message, which includes the application authentication QR code data;
[0221] Send a QR code creation request message to the server of the target application and obtain a QR code creation response message, which includes the application authentication QR code data and the uniform resource locator of the hypertext transfer protocol;
[0222] Obtain a pairing key, which includes a public key and a private key. Encode the public key to obtain a sensitive data parameter;
[0223] Generate the uniform resource locator of the QR code according to the preset version number, the sensitive data parameter, the application authentication QR code data, and the uniform resource locator of the hypertext transfer protocol;
[0224] Generate a QR code according to the uniform resource locator of the QR code.
[0225] Optionally, before obtaining the contact identifier of the target application in the first terminal if the authorization is successful, the method further includes:
[0226] Send a QR code authentication confirmation request message to the server of the target application and obtain a QR code authentication confirmation response message, which includes authentication success or authentication failure;
[0227] If the QR code authentication confirmation response message includes authentication success, send a personal identification number creation request message to the server of the target application and obtain a personal identification number creation request response message, which includes a personal identification number;
[0228] Send the personal identification number to the target application in the first terminal. If the target application in the first terminal successfully verifies the personal identification number, send a personal identification number authentication verification message to the target application in the first terminal. The personal identification number authentication verification message is used to verify whether the first terminal is successfully authorized.
[0229] Optionally, the data acquisition module further includes a chat database acquisition module, which is used for:
[0230] Back up the chat database of the target application in the first terminal to the target storage space;
[0231] Obtain the target account identification information of the target data, and obtain the chat database from the target storage space according to the target account identification information.
[0232] In this embodiment, the system essentially sets up multiple modules to execute the methods in the above embodiments. For the specific functions and technical effects, refer to the methods in the above embodiments, and details are not described herein again.
[0233] See Figure 4 , Embodiment of the present invention also provides an electronic device 400, including a processor 401, a memory 402, and a communication bus 403;
[0234] The communication bus 403 is used to connect the processor 401 and the memory 402;
[0235] The processor 401 is used to execute the computer program stored in the memory 402 to implement one or more of the methods as described in Embodiment 1 above.
[0236] Embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored,
[0237] The computer program is used to cause a computer to execute any one of the methods described in Embodiment 1 above.
[0238] Embodiment of the present application also provides a non-volatile readable storage medium, in which one or more modules (programs) are stored. When the one or more modules are applied to a device, the device can be caused to execute the instructions (instructions) of the steps included in Embodiment 1 of the present application.
[0239] It should be noted that the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable signal medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0240] The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist separately and not be assembled into the electronic device.
[0241] The computer program code for performing the operations of the present disclosure can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include object-oriented programming languages - such as Java, Smalltalk, C++, and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network - including a local area network (LAN) or a wide area network (WAN) - or, it can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).
[0242] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in a different order than that noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0243] The above-described embodiments are merely illustrative of the principles of the present invention and its effects, and are not intended to limit the present invention. Any person skilled in this technology may modify or change the above-described embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by those of ordinary skill in the art in the technical field without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A data transmission method, characterized in that, The method includes: Obtain the target data of the target application in the first terminal, where the target data includes contact information, group information, and a chat database; Write the contact information and group information into the chat database; Obtain the database rules of the target application in the second terminal, and generate an additional database based on the database rules and the chat database written with the contact information and group information; Create a backup package for the second terminal, and add the additional database to the backup package. The backup package is used for backup and restoration of the second terminal to realize the transfer of the target data from the first terminal to the second terminal, where the operating systems of the first terminal and the second terminal are different; The method for obtaining the contact information of the target application in the first terminal includes: Construct an authorization request QR code, which is used to be scanned by the target application in the first terminal for data acquisition authorization; If the authorization is successful, obtain the contact identifier of the target application in the first terminal; Obtain the contact information of each contact according to the contact identifier. The contact information includes at least one of the contact's mobile Internet device, name, creation time, avatar data, etc.; The construction method of the QR code includes: Send a session creation request message to the server of the target application, and obtain a session creation response message, where the session creation response message includes application authentication QR code data; Send a QR code creation request message to the server of the target application, and obtain a QR code creation response message, where the QR code creation response message includes the application authentication QR code data and the uniform resource locator of the hypertext transfer protocol; Obtain a pairing key, where the pairing key includes a public key and a private key, and encode the public key to obtain a sensitive data parameter; Generate the uniform resource locator of the QR code according to a preset version number, the sensitive data parameter, the application authentication QR code data, and the uniform resource locator of the hypertext transfer protocol; Generate the QR code according to the uniform resource locator of the QR code.
2. The data transmission method according to claim 1, wherein The target data further includes attachments. Before performing backup and restoration on the second terminal based on the backup package, the method further includes: Obtain the chat records from the chat database written with the contact information and group information, and determine the attachment location path of the attachments in the chat records; Obtain the attachment storage path of the target application in the second terminal; Store the attachments into the second terminal according to the attachment storage path and the attachment location path.
3. The data transmission method according to claim 1, characterized in that Before obtaining the contact identifier of the target application in the first terminal if the authorization is successful, the method further includes: Send a QR code authentication confirmation request message to the server of the target application, and obtain a QR code authentication confirmation response message, where the QR code authentication confirmation response message includes authentication success or authentication failure; If the QR code authentication confirmation response message includes authentication success, send a personal identification code creation request message to the server of the target application, and obtain a personal identification code creation request response message, where the personal identification code creation request response message includes a personal identification code; Send the personal identification number to the target application in the first terminal. If the target application in the first terminal successfully verifies the personal identification number, send a personal identification number authentication verification message to the target application in the first terminal. The personal identification number authentication verification message is used to verify whether the first terminal is successfully authorized.
4. The data transmission method according to any one of claims 1 to 3, characterized in that Obtaining the chat database of the target application in the first terminal includes: Back up the chat database of the target application in the first terminal to the target storage space; Obtain the target account identification information of the target data, and obtain the chat database from the target storage space according to the target account identification information.
5. A data transmission system, characterized in that, The system includes: A data acquisition module, configured to acquire target data of a target application in a first terminal, where the target data includes contact information, group information, and a chat database; A writing module, configured to write the contact information and group information into the chat database; A generating module, configured to obtain a database rule of a target application in a second terminal, and generate a new database according to the database rule and the chat database written with the contact information and group information; A creating module, configured to create a backup package of the second terminal, and add the new database to the backup package. The backup package is used for backup and restoration of the second terminal, so as to implement transmission of the target data from the first terminal to the second terminal, where operating systems of the first terminal and the second terminal are different; Wherein, the obtaining module specifically includes: Construct an authorization request two-dimensional code, which is used to be scanned by the target application in the first terminal for data acquisition authorization; If the authorization is successful, obtain the contact identifier of the target application in the first terminal; Obtain the contact information of each contact according to the contact identifier. The contact information includes at least one of a contact mobile Internet device, a name, a creation time, an avatar data, etc.; Send a session creation request message to the server of the target application, and obtain a session creation response message, where the session creation response message includes application authentication two-dimensional code data; Send a two-dimensional code creation request message to the server of the target application, and obtain a two-dimensional code creation response message, where the two-dimensional code creation response message includes the application authentication two-dimensional code data and a uniform resource locator of the hypertext transfer protocol; Obtain a pairing key, where the pairing key includes a public key and a private key, and encode the public key to obtain a sensitive data parameter; Generate a uniform resource locator of the two-dimensional code according to a preset version number, the sensitive data parameter, the application authentication two-dimensional code data, and the uniform resource locator of the hypertext transfer protocol; Generate the two-dimensional code according to the uniform resource locator of the two-dimensional code.
6. The data transmission system according to claim 5, wherein The system further includes at least one of the following: A driver detection module, configured to detect a driver of a target operating system in the data transmission system before the data acquisition module acquires target data of a target application in a first terminal. If the driver is missing or the version is lower than the latest version, install the latest version of the driver of the target operating system for the data transmission system. The target operating system includes a first terminal operating system and a second terminal operating system; An unlocking trust detection module, configured to detect whether both the first terminal and the second terminal have completed unlocking and trust before the data acquisition module acquires the target data of the target application in the first terminal. If unlocking and / or trust have not been completed, prompt for unlocking and / or trust authorization; A data backup module, configured to back up the chat database of the target application in the first terminal to a target storage space.
7. An electronic device, characterized in that, Comprising a processor, a memory, and a communication bus; The communication bus is used to connect the processor and the memory; The processor is configured to execute the computer program stored in the memory to implement the method according to any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, On which a computer program is stored, The computer program is used to cause the computer to execute the method according to any one of claims 1-4.
Citation Information
Patent Citations
Data migration method and device between different types of databases and storage medium
CN112749151A
Method and device for backing up and restoring IOS end data at Android end, and related components
CN113568784A