File downloading method, device, computer-readable storage medium, and computer equipment
The method ensures secure and stable file downloads by using a foreground service application to manage file transfers for background client applications, addressing security and completion issues in existing APIs.
Patent Information
- Application Number
- CN202010129068.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-28
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2040-02-28
AI Technical Summary
Existing file download methods through mobile terminal system APIs are insecure, as files can be easily accessed by the system or other applications, and the download process is prone to interruptions, leading to low security and success rates.
A method where a service application in the foreground downloads files on behalf of a client application in the background by exchanging file identifiers and progress information, using secure communication channels to ensure the file is transferred securely and completed.
Enhances file download security and stability by preventing unauthorized access and minimizing interruptions, thereby improving success rates and ensuring seamless file transfer between foreground and background applications.
Smart Images

Figure CN113329045B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a file downloading method, device, computer-readable storage medium and computer equipment. Background Art
[0002] With the development of Internet technology, various applications suitable for mobile terminals emerge in an endless stream; when an application is switched to run in the background, it is impossible to use the network to download files.
[0003] However, when the application is switched to the background, files are generally downloaded through the API interface provided by the mobile terminal system. However, files downloaded through the API interface provided by the mobile terminal system can be easily obtained by the system or even other applications, and their download links can be easily identified, resulting in low security for file downloads. Summary of the invention
[0004] Based on this, it is necessary to provide a file downloading method, apparatus, computer-readable storage medium and computer device to address the technical problem of low security of file downloading.
[0005] A file downloading method, comprising:
[0006] Receive a foreground operation trigger instruction, and enter a foreground operation state according to the foreground operation trigger instruction;
[0007] If it is in the foreground running state, then obtain the file download information; the file download information carries the file identifier and the client application identifier;
[0008] The file identifier is sent to the client application corresponding to the client application identifier; the client application is used to obtain the file download progress corresponding to the file identifier;
[0009] Receiving the file download progress returned by the client application;
[0010] Sending the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file;
[0011] Receive the file returned by the server, and send the file to the client application.
[0012] A file downloading device, comprising:
[0013] An instruction receiving module, used for receiving a foreground operation trigger instruction, and entering a foreground operation state according to the foreground operation trigger instruction;
[0014] An information acquisition module, used for acquiring file download information if the application is in the foreground running state; the file download information carries a file identifier and a client application identifier;
[0015] An identification sending module, used for sending the file identification to the client application corresponding to the client application identification; the client application is used for obtaining the file download progress corresponding to the file identification;
[0016] A download progress receiving module, used for receiving the file download progress returned by the client application;
[0017] A download progress sending module, used to send the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file;
[0018] The file sending module is used to receive the file returned by the server and send the file to the client application.
[0019] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0020] Receive a foreground operation trigger instruction, and enter a foreground operation state according to the foreground operation trigger instruction;
[0021] If it is in the foreground running state, then obtain the file download information; the file download information carries the file identifier and the client application identifier;
[0022] The file identifier is sent to the client application corresponding to the client application identifier; the client application is used to obtain the file download progress corresponding to the file identifier;
[0023] Receiving the file download progress returned by the client application;
[0024] Sending the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file;
[0025] Receive the file returned by the server, and send the file to the client application.
[0026] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the following steps:
[0027] Receive a foreground operation trigger instruction, and enter a foreground operation state according to the foreground operation trigger instruction;
[0028] If it is in the foreground running state, then obtain the file download information; the file download information carries the file identifier and the client application identifier;
[0029] The file identifier is sent to the client application corresponding to the client application identifier; the client application is used to obtain the file download progress corresponding to the file identifier;
[0030] Receiving the file download progress returned by the client application;
[0031] Sending the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file;
[0032] Receive the file returned by the server, and send the file to the client application.
[0033] The above-mentioned file downloading method, device, computer-readable storage medium and computer equipment, if the service application is in the foreground running state, obtains file download information, which carries a file identifier and a client application identifier; then sends the file identifier to the client application corresponding to the client application identifier, and receives the file download progress corresponding to the file identifier returned by the client application, and then sends the file download progress to the server; finally receives the file downloaded by the server according to the file download progress, and sends the file to the client application; realizes the purpose of downloading the file required by the client application through the service application in the foreground running state when the client application is in the background running state; avoids the defect that the file downloaded through the API interface provided by the mobile terminal system is easily directly obtained by the system or even other applications, thereby causing low security of file downloading, and further improves the security of file downloading; at the same time, avoids the defect that the process of downloading files through the API interface provided by the mobile terminal system is easily interrupted by the mobile terminal system, resulting in a low success rate of file downloading, thereby improving the success rate and stability of file downloading. In addition, by downloading the files required by the client application through the service application running in the foreground, the file download function of the service application running in the foreground is shared to achieve the purpose of file download for other client applications running in the background, avoiding the defect that the client application cannot download files when it is running in the background, and further improving the success rate of file download. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 An application environment diagram of a file downloading method in an embodiment;
[0035] Figure 2 A schematic diagram of a process flow of a file downloading method in one embodiment;
[0036] Figure 3 A flowchart of the steps of storing file download information in an internal database in one embodiment;
[0037] Figure 4 A flowchart of the steps of obtaining file download information in one embodiment;
[0038] Figure 5 A flowchart of the steps of obtaining file download information in another embodiment;
[0039] Figure 6 A flowchart of a step of sending a file identifier to a client application corresponding to a client application identifier in one embodiment;
[0040] Figure 7 A flowchart of the steps of obtaining the latest download status information in one embodiment;
[0041] Figure 8 A flowchart of a step of sending a file download progress to a server in one embodiment;
[0042] Fig. 9 A schematic diagram of a flow chart of steps for verifying a file in one embodiment;
[0043] Fig.10 A flowchart of the steps of sending a file to a client application in one embodiment;
[0044] Fig.11 A schematic flow chart of the steps of decrypting a file in one embodiment;
[0045] Fig.12 A flowchart of the steps of returning the latest status of a file in one embodiment;
[0046] Fig.13 A schematic diagram of a flow chart of a file downloading method in another embodiment;
[0047] Fig.14 A flowchart of a file downloading method in another embodiment;
[0048] Fig.15 A schematic diagram of a flow chart of a file downloading method in yet another embodiment;
[0049] Fig.16 A structural block diagram of a file downloading device in an embodiment;
[0050] Fig.17 FIG. 4 is a structural block diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0052] Figure 1 FIG. 1 is an application environment diagram of a file download method in an embodiment. Figure 1 The application environment diagram includes a terminal 110 and a server 120. A service application 111 and a client application 112 are installed in the terminal 110. The service application 111 is connected to the client application 112 and the server 120 through a network respectively. The terminal 110 is an electronic device with a file download function. The electronic device can be a smart phone, a tablet computer or a personal computer, etc. The service application 111 and the client application 112 both refer to applications in the terminal 110 that provide services to users. The server 120 can be implemented by an independent server or a server cluster composed of multiple servers.
[0053] In one embodiment, referring to Figure 1 , the service application 111 receives the foreground operation trigger instruction, and enters the foreground operation state according to the foreground operation trigger instruction; if it is in the foreground operation state, it obtains the file download information; the file download information carries the file identifier and the client application identifier; the file identifier is sent to the client application 112 corresponding to the client application identifier; at this time, the client application 112 is in the background operation state. The client application 112 obtains the file download progress corresponding to the received file identifier, and sends the file download progress to the service application 111. The service application 111 sends the file download progress returned by the client application 112 to the server 120. The server 120 downloads the corresponding file according to the received file download progress, and sends the file to the service application 111; the service application 111 sends the received file to the client application 112. In addition, the file download method can also be applied to game file download scenarios, file download charging scenarios, etc., which are not specifically limited in this application.
[0054] like Figure 2 As shown, in one embodiment, a file download method is provided. This embodiment mainly applies this method to the above Figure 1 The service application 112 in FIG. Figure 2 The file download method specifically includes the following steps:
[0055] S202, receiving a foreground operation trigger instruction, and entering a foreground operation state according to the foreground operation trigger instruction.
[0056] Among them, there are multiple applications installed in the mobile terminal. The trusted application that can provide file download function is called service application, and the application that needs to download files is called client application. In addition, the same application can be both a service application and a client application, depending on the actual scenario.
[0057] Among them, on a mobile terminal with a screen, if the interface of an application is displayed on the screen of the mobile terminal, the application is said to be in the foreground running state; if the mobile terminal returns to the desktop or switches to other applications, the interface of the application is not displayed on the screen of the mobile terminal, and the application is said to be in the background running state. It should be noted that when the application is in the foreground running state, the user can directly operate the application; when the application is in the background running state, the user cannot directly operate the application, but the application will occupy the system resources of the mobile terminal.
[0058] The foreground running trigger instruction refers to an instruction that triggers the application to enter the foreground running state, such as an instruction that switches the application in the background running state to the foreground running state.
[0059] Specifically, the service application receives a foreground running trigger instruction from the mobile terminal for the service application, responds to the foreground running trigger instruction, and enters a foreground running state.
[0060] For example, the user clicks on the service application in the application management interface, triggering the mobile terminal to generate a foreground running trigger instruction for the service application, and sends the foreground running trigger instruction to the service application. The service application enters the foreground running state according to the foreground running trigger instruction.
[0061] S204, if it is in the foreground running state, obtain file download information; the file download information carries a file identifier and a client application identifier.
[0062] Among them, file download information refers to information used to identify file download-related information, including file download link, file segment information, file verification information, file identifier, client application identifier, etc.; file segment information refers to information of each sub-file in a complete file; file verification information refers to the hash value, verification code, etc. of the file; file identifier refers to information used to identify a file, such as file name, file number, etc.; client application identifier refers to information used to identify a client application, such as client application name, client application number, etc.
[0063] Specifically, if the service application is in the foreground running state, it queries whether the internal storage contains file download information, and if so, obtains the file download information; the file download information is parsed to obtain the file identifier and the client application identifier. The internal storage refers to the storage space of the service application, which is used to store the file download information sent by the client application.
[0064] Furthermore, if the service application is in the foreground running state, it can also determine whether to execute the task of querying whether the internal storage contains file download information according to the trigger logic set by the service application itself; for example, if the service application is in the foreground running state, and at a specific time and under a specific operating state, it will query whether the internal storage contains file download information to start the file download task.
[0065] For example, when a client application starts a file download task, it finds that the file to be downloaded is relatively large and is worried that the client application cannot download it smoothly, so it sends the file download information to the trusted service application; or when starting the file download task, it is worried that the client application will suddenly be switched to the background or other emergencies will occur, resulting in the interruption of the file download, and the file download task can only be started after the client application is switched back to the foreground; then the file download information is sent to the trusted service application. When the client application is switched to the background, that is, when the client application is in the background, the file download is suspended; at this time, if the service application is switched to the foreground, that is, when the service application is in the foreground, the file download information of the client application is obtained from the internal storage, and the file or file fragment is downloaded based on the file download information.
[0066] In addition, if the service application is in the foreground running state, it can also actively query whether the client application on the mobile terminal has files to download without the client application's active request; if the client application has files to download, the file download information of the client application is obtained.
[0067] S206, sending the file identifier to the client application corresponding to the client application identifier; the client application is used to obtain the file download progress corresponding to the file identifier.
[0068] S208, receiving the file download progress returned by the client application.
[0069] The file download progress is used to indicate the latest download status of the file, such as one third downloaded, one half downloaded, etc.
[0070] Specifically, the service application determines the client application corresponding to the client application identifier, and sends the file identifier to the client application; the client application receives the file identifier, queries the internal storage of the client application, obtains the file download progress corresponding to the file identifier, and sends the file download progress to the service application, and the file download progress is received by the service application. The internal storage of the client application is used to store various file download information, such as file download progress, file verification information, etc.
[0071] For example, the service application calls the download service component and sends the file identifier to the client application corresponding to the client application identifier to wake up the client service component of the client application; the client service component obtains the file download progress corresponding to the file identifier from the internal storage of the client application, and sends the file download progress to the download service component of the service application, and then the service application receives the file download progress. In this way, data communication between the service application and the client application is realized by calling the service component, which is conducive to realizing information synchronization between the service application and the client application. Among them, the download service component refers to the download service process, and the client service component refers to the client service process.
[0072] S210, sending the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file.
[0073] Specifically, the service application sends the received file download progress to the corresponding server through the preset communication channel; the server determines the file to be downloaded based on the received file download progress and downloads the file. In this way, the communication security and stability between the service application and the server can be guaranteed through the preset communication channel. Among them, the preset communication channel refers to the channel for network communication between the service application and the server, such as the Https communication channel.
[0074] For example, the service application pre-establishes an Https communication channel with the server, and sends the file download progress to the server through the Https communication channel; the server downloads the corresponding file according to the file download progress.
[0075] Furthermore, after determining the files that need to be downloaded based on the received file download progress, the server can also split the files that need to be downloaded into multiple file fragments, and download each file fragment in turn; in this way, by utilizing the data segmentation method, the coordinated download of files can be better realized, avoiding the defect of low file download efficiency caused by the need to re-download the entire file if a certain information in the entire file is downloaded incorrectly, thereby improving the file download efficiency.
[0076] S212, receiving the file returned by the server, and sending the file to the client application.
[0077] Specifically, the server sends the downloaded file to the service application through a preset communication channel; the service application sends the received file to the corresponding client application, thereby realizing the download of the file.
[0078] For example, after the service application receives a file or file fragment returned by the server, it actively wakes up the customer service component of the client application by calling the download service component of the service application, and sends the file or file fragment to the customer service component of the client application, so that the client application can receive, verify and merge the file or file fragment.
[0079] Furthermore, after receiving the file returned by the server, the service application can also verify the correctness of the received file, such as using a digital signature or hash verification method; if the file verification passes, it means that the file downloaded through the server is correct, and the file is sent to the client application; the client application can also verify the correctness of the received file. If the file verification passes, it means that the file downloaded through the service application is correct, and the file can be used, counted, downloaded and charged for. In this way, by verifying the correctness of the file, the file can be prevented from being tampered with, which is conducive to improving the security of file downloading. At the same time, the client application can also update the file download progress according to the received file. If it is recognized that the file download is complete, the above process ends. If it is recognized that the file is not downloaded, steps S208 to S212 are repeated until the file download is complete.
[0080] It should be noted that if the entire file has not been downloaded at this time and the service application is switched to background operation, that is, the service application is in the background running state, the download task of the service application is completed; if another service application is in the foreground running state, the above steps S202 to S210 are repeated until the file download is completed.
[0081] It should be noted that if multiple service applications are installed on the mobile terminal, the multiple service applications on the mobile terminal can cooperate to download the entire file based on the same file downloading method.
[0082] The above-mentioned file download method, if the service application is in the foreground running state, obtains file download information, which carries a file identifier and a client application identifier; then sends the file identifier to the client application corresponding to the client application identifier, and receives the file download progress corresponding to the file identifier returned by the client application, and then sends the file download progress to the server; finally, receives the file downloaded by the server according to the file download progress, and sends the file to the client application; realizes the purpose of downloading the file required by the client application through the service application in the foreground running state when the client application is in the background running state; avoids the defect that the file downloaded through the API interface provided by the mobile terminal system is easily directly obtained by the system or even other applications, thereby causing low security of file download, and further improves the security of file download; at the same time, avoids the defect that the process of downloading files through the API interface provided by the mobile terminal system is easily interrupted by the mobile terminal system, resulting in a low success rate of file download, thereby improving the success rate and stability of file download. In addition, by downloading the files required by the client application through the service application running in the foreground, the file download function of the service application running in the foreground is shared to achieve the purpose of file download for other client applications running in the background, avoiding the defect that the client application cannot download files when it is running in the background, and further improving the success rate of file download.
[0083] In one embodiment, the above step S204, obtaining the file download information, includes: obtaining the file download information from an internal database; the internal database stores the file download information sent by the client application.
[0084] Specifically, when the service application is in the foreground running state, if the internal database contains multiple file download information, the service application obtains the file download information with the earliest storage time from the internal database; or obtains the file download information with the highest priority from the internal database. For example, if some files have a high timeliness requirement, the corresponding file download information has a high priority; if some files have a low timeliness requirement, the corresponding file download information has a low priority. This is conducive to determining the file download progress according to the file download information in the future, and then downloading the corresponding file, avoiding repeated downloading of files.
[0085] like Figure 3 As shown, in one embodiment, in the above step S202, before receiving the foreground running trigger instruction and entering the foreground running state according to the foreground running trigger instruction, the following steps are specifically included:
[0086] S302, receiving file download information sent by the client application; if the client application is in the foreground running state and detects that there is currently a download task, it generates a file download request, sends the file download request to the server, and receives the file download information returned by the server according to the file download request.
[0087] The file download request refers to a request for requesting a trusted service application to assist in downloading a file.
[0088] Specifically, if the client application is in the foreground running state, it detects whether there is a download task currently. If it is detected that there is a download task currently, such as the need to download a large file currently, a file download request is generated and the file download request is sent to the corresponding server; the server downloads the corresponding file according to the file download request, and returns the corresponding file download information (such as file identification, file download link, file segmentation information, etc.) to the client application; the client application obtains the service application identification of the trusted service application on the mobile terminal, and sends the received file download information to the service application corresponding to the service application identification; the service application receives the file download information sent by the client application, and the service application is in the background running state or is not opened.
[0089] For example, if a large file needs to be downloaded, the client application sends the file download information to service applications corresponding to multiple service application identifiers. If a small file needs to be downloaded, the client application sends the file download information to a service application corresponding to a single service application identifier.
[0090] S304, storing the file download information in an internal database.
[0091] Specifically, the service application extracts the client application identifier from the file download information, and stores the file download information into an internal database according to the client application identifier classification, so as to store the file download information corresponding to multiple client application identifiers through the internal database, making it convenient for subsequent service applications to obtain the file download information corresponding to the client application identifier from the internal database.
[0092] In one embodiment, referring to Figure 4First, determine the download service component identifier of the service application. When the service application is installed or updated, register the download service component identifier with the system service manager; for example, service application A registers the download service component A identifier with the system service manager, and service application B registers the download service component B identifier with the system service manager. Next, the user application (in the foreground at this time) detects that a large file needs to be downloaded based on its own business logic, and queries the download service component identifier through the system service manager, and receives the download service component identifier returned by the system service manager; selects one or more download service components corresponding to the download service component identifiers to assist in the download according to its own strategy; for example, the user application calls the client component to receive the download information, key, user application identifier and other information returned by the server, and saves the download information, key, user application identifier and other information returned by the server in real time in the internal storage of the user application; wakes up the download service component of service application A through the system service manager, and sends the download information, key, user application identifier and other information to the download service component of service application A through the system service manager; service application A saves the download information, key, user application identifier and other information in the internal storage of service application A through its own download service component, so that when service application A is in the foreground running state, it can download the file based on the download information through its own download service component.
[0093] like Figure 5 As shown, in one embodiment, the above step S204, obtaining file download information, also includes the following steps:
[0094] S502, sending a preset query request to the client application; the preset query request is used to trigger the client application to obtain file download information; the file download information carries a file identifier and a client application identifier.
[0095] S504, receiving the file download information returned by the client application.
[0096] Specifically, the service application obtains the client application identifier on the mobile terminal and sends a preset query request to the client application corresponding to the client application identifier; the client application queries whether the file download information is stored in the internal storage of the client application based on the received preset query request. If the file download information is stored in the internal storage of the client application, it means that the client application currently has a file to download. The file download information is then obtained and sent to the service application.
[0097] In this embodiment, the service application actively obtains file download information from the client application, which facilitates the subsequent download of the corresponding file based on the file download information, avoids the defect that the client application cannot download files when it is in the background running state, and further improves the success rate of file download.
[0098] like Figure 6 As shown, in one embodiment, the above step S206, sending the file identifier to the client application corresponding to the client application identifier, specifically includes the following steps:
[0099] S602: Generate a request for obtaining the progress of file download according to the file identifier.
[0100] S604, sending a file download progress acquisition request to the client application corresponding to the client application identifier; the file download progress acquisition request is used to trigger the client application to acquire the file download progress corresponding to the file identifier.
[0101] Specifically, the service application obtains a preset file download progress acquisition request template, imports the file identifier into the corresponding position in the preset file download progress acquisition request template, generates a file download progress acquisition request, and sends the file download progress acquisition request to the client application corresponding to the client application identifier; the client application queries the internal storage of the client application based on the file download progress acquisition request, obtains the file download progress corresponding to the file identifier, and sends the file download progress to the service application.
[0102] For example, see Figure 7, the user application is in the background at this time, and has a client service component; the service application A is in the foreground at this time, and has a download service component; the service application A stores file download information, keys (such as KEY), and client application identifiers (such as TOKEN) in its internal storage; the server stores file information (such as file download links, file segment information, etc.), billing logic, etc. The service application A wakes up the download service component at a specific time, and checks whether the internal storage of the service application A contains file download information through the download service component. If the internal storage of the service application A contains file download information, the file download information, client application identifier, etc. are obtained; the file identifier is extracted from the file download information, and the file identifier is sent to the client service component in the client application corresponding to the client application identifier to request the latest download status information of the file corresponding to the file identifier; the client application queries the internal storage of the client application by calling the client service component, obtains the latest download status information of the file corresponding to the file identifier, and returns the latest download status information of the file to the download service component of the service application A; the service application A requests the server to obtain the corresponding file through the download service component, and receives the file returned by the server.
[0103] In this embodiment, by sending the file identifier to the client application corresponding to the client application identifier, it is beneficial for the client application to obtain the file download progress corresponding to the file identifier, thereby facilitating subsequent downloading of the corresponding file according to the file download progress and avoiding repeated downloading.
[0104] like Figure 8 As shown, in one embodiment, the above step S210, sending the file download progress to the server, specifically includes the following steps:
[0105] S802: Determine the identifier of the file to be downloaded according to the file download progress.
[0106] Specifically, the service application determines the latest download status information of the file according to the file download progress; and determines the file identifiers of the remaining files to be downloaded according to the latest download status information of the file as the file identifiers to be downloaded.
[0107] S804, sending the identifier of the file to be downloaded to the server; the server is used to obtain the file to be downloaded corresponding to the identifier of the file to be downloaded, divide the file to be downloaded into at least two block files, and download each block file according to a preset download order.
[0108] The block files refer to files divided from the files to be downloaded, and the preset download order refers to the order in which the block files are downloaded.
[0109] It should be noted that at least two block files refer to two or more block files, which is not specifically limited in this application.
[0110] Specifically, the service application sends the identifier of the file to be downloaded to the server through a preset communication channel; the server obtains the file to be downloaded corresponding to the identifier of the file to be downloaded through the network, and uses data segmentation to split the file to be downloaded to obtain at least two block files, such as splitting according to the data volume, and evenly dividing the file to be downloaded into multiple block files; each block file is downloaded according to a preset download order, such as downloading each block file in sequence according to the order of the segmented files.
[0111] In this embodiment, by utilizing data fragmentation, the coordinated download of files can be better achieved, avoiding the defect of low file download efficiency caused by the need to re-download the entire file if a certain information in the entire file is downloaded incorrectly, thereby improving the file download efficiency.
[0112] In one embodiment, the above step S212, before sending the file to the client application, further includes: verifying the file. Then, the above step S212, sending the file to the client application, includes: if the file verification passes, sending the file to the client application.
[0113] Specifically, the service application verifies the file sent by the server. If the file verification passes, it means that the file downloaded from the server is correct, and the file is sent to the client application; if the file verification fails, it means that the file downloaded from the server is wrong, and the server is requested to download the file again.
[0114] In this embodiment, by verifying the file sent by the server, the security of the file download can be guaranteed, and the defect of errors in the downloaded file caused by the file being tampered with can be avoided.
[0115] like Fig. 9 As shown, in one embodiment, the file carries a corresponding first verification code; verifying the file specifically includes the following steps:
[0116] S902, obtaining a preset verification code counting instruction.
[0117] The preset verification code counting instruction refers to an instruction that can count the verification codes of a file, such as a hash value counting instruction.
[0118] S904, counting the file according to a preset verification code counting instruction to obtain a verification code of the file as a second verification code of the file.
[0119] The first verification code and the second verification code may refer to hash values of the file, such as SHA256 hash values.
[0120] S906: If the first verification code matches the second verification code, confirm that the file verification is successful.
[0121] Specifically, the service application obtains a preset verification code statistical instruction from a local database; performs statistical analysis on the file through the preset verification code statistical instruction to obtain a second verification code of the file; matches the first verification code and the second verification code of the file. If the first verification code and the second verification code of the file match successfully, it means that the file verification passes; if the first verification code and the second verification code of the file fail to match, it means that the file verification fails.
[0122] For example, assume that the first verification code carried by the file refers to the first hash value of the file; the service application obtains a preset hash value statistical instruction, analyzes and calculates the file according to the preset hash value statistical instruction, and obtains the hash value of the file as the second hash value of the file; the first hash value and the second hash value of the file are matched. If the match is successful, it means that the file verification is passed; if the match fails, it means that the file verification has failed.
[0123] In this embodiment, by verifying the file sent by the server, the security of the file download can be guaranteed, and the defect of errors in the downloaded file caused by the file being tampered with can be avoided.
[0124] like Fig.10 As shown, in one embodiment, the above step S212, sending the file to the client application, specifically includes the following steps:
[0125] S1002: Encrypt the file according to a preset first key to obtain an encrypted file.
[0126] The preset first key refers to a parameter for encrypting a file, such as a public key.
[0127] For example, the service application obtains the string of the file and adds the preset first key after the string of the file, or adds the preset first key before the string of the file to obtain a new string as the encrypted file.
[0128] S1004, sending the encrypted file and the preset first key to the client application; the client application is used to send the key identifier corresponding to the preset first key to the server, receive the second key corresponding to the key identifier returned by the server, decrypt the encrypted file according to the second key, and obtain the file; the second key matches the preset first key.
[0129] The key identifier corresponding to the preset first key refers to the identification information of the preset first key, such as the key code, key serial number, etc. The second key refers to the parameter for decrypting the encrypted file, such as the private key, etc. The second key matches the preset first key means that the second key and the preset first key correspond to each other, for example, the preset first key is a public key, and the second key refers to the private key corresponding to the preset first key.
[0130] Specifically, the service application sends the encrypted file and the preset first key to the client application; the client application obtains the key identifier corresponding to the preset first key and sends the key identifier to the server; the server obtains the second key identifier corresponding to the key identifier, and queries and stores the second keys corresponding to multiple second key identifiers, obtains the second key corresponding to the second key identifier as the second key corresponding to the key identifier, and decrypts the encrypted file according to the second key to obtain the file. In this way, the file is encrypted by the service application to prevent the file from being tampered with during the transmission process, and the security of file download is further guaranteed.
[0131] For example, the client application obtains a public key identifier corresponding to a preset first key, and sends the public key identifier to the server; the server obtains a private key identifier corresponding to the public key identifier, and queries and stores second keys corresponding to multiple private key identifiers, obtains the second key corresponding to the private key identifier, and uses it as the second key corresponding to the public key identifier. The encrypted file is decrypted according to the second key to obtain the file.
[0132] For example, see Fig.11 In the file download billing scenario, the service application encrypts the downloaded whole file to obtain the whole encrypted file; wakes up the client service component of the client application and sends the whole encrypted file to the client service component of the client application; the client application requests the billing server to obtain the decryption key by calling the client service component, receives the decryption key returned by the billing server, and then decrypts the whole encrypted file according to the decryption key to obtain the original whole file. In this process, before the client application obtains a decryption key from the billing server, it needs to pay the corresponding fee to the billing server, and the billing server transfers the corresponding fee to the service application; at the same time, after the client application decrypts the original whole file, it actively notifies the service application of the billing status to realize the billing of successful download. If the file download billing is implemented in this process, it can better prevent malicious non-payment or request for overpayment, thereby ensuring the security and effectiveness of file download billing.
[0133] In one embodiment, the file download method of the present application also includes: receiving an updated file download progress returned by the client application; the client application is used to update the file download progress according to each received file to obtain an updated file download progress; then the above step S208, sending the file download progress to the server, includes: sending the updated file download progress to the server; the updated file download progress is used to trigger the server to download the corresponding file.
[0134] Specifically, the client application determines the downloaded files according to each received file; updates the file download progress according to the downloaded files to obtain the updated file download progress; for example, file A is divided into 5 files, namely file A1, file A2, file A3, file A4 and file A5, and the original file download progress is that file A1 has been downloaded, and file A2, file A3, file A4 and file A5 have not been downloaded. If the files received this time are file A2 and file A3, it means that the downloaded files are file A2 and file A3, then the original file download progress is updated according to the downloaded files, and file A1, file A2 and file A3 have been downloaded, and file A4 and file A5 have not been downloaded, as the updated file download progress; then, the client application sends the updated file download progress to the service application; the service application sends the updated file download progress to the server, and the server downloads the corresponding file according to the updated file download progress until the file download is completed. In this way, it is conducive to real-time update and synchronization of file download progress, and avoids the defect of repeated file download.
[0135] For example, see Fig.12, the server stores file information, billing logic information, verification information, and segmentation information; service application A is in the foreground at this time and has a corresponding download Service component; the user application is in the background at this time and has a corresponding client Service component; the user application internal storage stores verification information, status information, billing information, etc. After the user application returns the latest download status information of the file to service application A, service application A wakes up the download Service component at a specific time, requests to obtain the file from the server, and receives the file information and the entire file returned by the server; wakes up the client Service component of the client application, and sends the entire file to the client Service component of the client application through the download Service component; the client Service component of the client application obtains the verification information, and verifies the entire file based on the verification information; if the file verification passes, the file status information is updated based on the entire file to obtain the latest status of the file, and the latest status of the file is sent to the download Service component of service application A; the download Service component of service application A receives the file through the file The client application wakes up the client Service component of the client application again, and sends the entire file to the client Service component of the client application through the download Service component; the client Service component of the client application obtains the verification information, and verifies the entire file again according to the verification information; if the file verification passes, the file status information is updated again according to the entire file to obtain the latest status of the file, and the latest status of the file is sent again to the download Service component of service application A; the download Service component of service application A requests to obtain the next file from the server again through the latest status of the file, until the server completes downloading the last file.
[0136] like Fig.13 As shown, in one embodiment, another file downloading method is provided. This embodiment mainly applies this method to the above Figure 1 The client application 111 in FIG. Fig.13 The file download method specifically includes the following steps:
[0137] S1302, receiving the file identifier sent by the service application; the service application is used to receive the foreground operation trigger instruction, enter the foreground operation state according to the foreground operation trigger instruction, and if it is in the foreground operation state, obtain the file download information; the file download information carries the file identifier.
[0138] S1304: Obtain the file download progress corresponding to the file identifier.
[0139] S1306, sending the file download progress to the service application; the service application is used to send the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file; and receiving the file returned by the server.
[0140] S1308, receiving the file returned by the service application.
[0141] It should be noted that the specific implementation of the above steps has been described in detail in the above-mentioned embodiment of the method, and will not be elaborated here.
[0142] The above-mentioned file download method receives the file identifier sent by the service application in the foreground running state through the client application in the background running state, and obtains the file download progress corresponding to the file identifier; then sends the file download progress to the service application, and requests the server to download the corresponding file based on the file download progress through the service application; finally receives the file returned by the service application; realizes the purpose of downloading the file required by the client application through the service application in the foreground running state when the client application is in the background running state; avoids the defect that the file downloaded through the API interface provided by the mobile terminal system is easily directly obtained by the system or even other applications, thereby causing the defect of low security of file download, and further improves the security of file download; at the same time, avoids the defect that the process of downloading files through the API interface provided by the mobile terminal system is easily interrupted by the mobile terminal system, resulting in a low file download success rate, thereby improving the success rate and stability of file download. In addition, by downloading the file required by the client application through the service application in the foreground running state, the file download function of the service application in the foreground running state is shared to realize the purpose of file download of other client applications in the background running state, avoiding the defect that the client application cannot download files when it is in the background running state, and further improving the success rate of file download.
[0143] In one embodiment, the file download method of the present application also includes: if the file verification is passed, the file download progress is updated according to the file to obtain an updated file download progress; then, the above step S1306, sending the file download progress to the service application, includes: sending the updated file download progress to the service application; the service application is used to send the updated file download progress to the server; the updated file download progress is used to trigger the server to download the corresponding file.
[0144] Specifically, after the file returned by the service application is verified, the client application determines the downloaded file according to the file returned by the service application; updates the file download progress according to the downloaded file, obtains the updated file download progress, and sends the updated file download progress to the service application; the service application sends the updated file download progress to the server; the server downloads the corresponding file according to the updated file download progress until the file download is completed. In this way, it is conducive to real-time update and synchronization of file download progress, and avoids the defect of repeated file download.
[0145] like Fig.14 In one embodiment, another file downloading method is provided, which specifically includes the following steps:
[0146] S1400: If the client application is in the foreground running state and detects that there is a download task currently, a file download request is generated and sent to the server.
[0147] S1402, the server obtains corresponding file download information according to the file download request, and sends the file download information to the service application running in the background.
[0148] S1404, the service application stores the received file download information in an internal database.
[0149] S1406, the service application receives a foreground operation trigger instruction, and enters a foreground operation state according to the foreground operation trigger instruction.
[0150] S1408, if the service application is in the foreground running state, the file download information is obtained from the internal database; the file download information carries the file identifier and the client application identifier.
[0151] S1410, the service application generates a file download progress acquisition request according to the file identifier, and sends the file download progress acquisition request to the client application corresponding to the client application identifier; the client application is in a background running state.
[0152] S1412, the client application obtains the file download progress corresponding to the file identifier according to the file download progress acquisition request, and sends the file download progress to the service application.
[0153] S1414, the service application determines the identifier of the file to be downloaded according to the file download progress, and sends the identifier of the file to be downloaded to the server.
[0154] S1416: The server obtains the file to be downloaded corresponding to the file identifier to be downloaded, divides the file to be downloaded into at least two block files, and downloads each block file according to a preset download order.
[0155] S1418, the service application receives the block files returned by the server and verifies the block files.
[0156] S1420, if the block file verification passes, the service application encrypts the block file according to the preset first key to obtain an encrypted file; and sends the encrypted file and the preset first key to the client application.
[0157] S1422, the client application identifies the key identifier corresponding to the preset first key, and sends the key identifier corresponding to the preset first key to the server.
[0158] S1424, the server obtains a second key corresponding to the key identifier, and sends the second key to the client application.
[0159] S1426, the client application decrypts the encrypted file according to the second key to obtain a block file; the second key matches the preset first key.
[0160] S1428, the client application updates the file download progress according to the block files, and obtains the updated file download progress.
[0161] S1430, the client application detects whether the file download is complete according to the updated file download progress, if so, proceeds to step S1432; if not, jumps to step S1408.
[0162] S1432, end downloading.
[0163] The above-mentioned file download method realizes the purpose of downloading the files required by the client application through the service application in the foreground when the client application is in the background running state; it avoids the defect that the files downloaded through the API interface provided by the mobile terminal system are easily directly obtained by the system or even other applications, thereby causing low security of file downloading, and further improves the security of file downloading; at the same time, it avoids the defect that the process of downloading files through the API interface provided by the mobile terminal system is easily interrupted by the mobile terminal system, resulting in a low success rate of file downloading, thereby improving the success rate and stability of file downloading. In addition, by downloading the files required by the client application through the service application in the foreground running state, the file download function of the service application in the foreground running state is shared to realize the purpose of file downloading of other client applications in the background running state, avoiding the defect that the client application cannot download files when it is in the background running state, and further improving the success rate of file downloading.
[0164] like Fig.15 As shown, in one embodiment, another file download method is provided, which specifically includes the following contents: when the client application is in the foreground and needs to download a specific file, the file is directly requested from the server and the file transfer is directly started; in this process, the client application simultaneously notifies the service application on the mobile terminal of the download demand; for example, the client application learns through inter-process communication that there is a corresponding service application available on the mobile terminal, and then sends the file information to be downloaded (such as file link, fragmentation information, verification information, etc.) to the service application. When the client application is switched to the background and the service application is switched to the foreground, the service application checks that there is a download demand of the client application, and then inquires the client application about the download progress of the file through the inter-process communication mechanism provided by the mobile terminal system, and receives the download progress of the file returned by the client application; according to the download progress of the file, the remaining files to be downloaded are determined, and the server is requested to download the remaining files, and the remaining files returned by the server are received; the remaining files are sent to the client application, and the client application is requested to update the download progress, while continuing to request the server to download the remaining files. In this process, the client application can actively request the service application to download the file, and receive the remaining files returned by the service application. When the server returns the last remaining file, the service application sends the last remaining file to the client application and notifies the client application that the file download is complete. Finally, after the client application is switched to the foreground, the client application accepts and merges the file downloaded with the assistance of the service application, verifies the file, and can use the file directly if the file verification passes.
[0165] The above-mentioned file downloading method downloads the files required by the client application through the service application running in the foreground, thereby achieving the purpose of sharing the file download function of the service application running in the foreground to realize the file download of other client applications running in the background, avoiding the defect that the client application cannot download files when it is running in the background, thereby improving the success rate of file downloading; at the same time, it avoids the defect that the process of downloading files through the API interface provided by the mobile terminal system is easily interrupted by the mobile terminal system, resulting in a low success rate of file downloading, and further improves the success rate and stability of file downloading.
[0166] It should be understood that although Figure 2 , 3 The steps in the flowcharts of , 5, 6, 8, 9, 10, 13, and 14 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , 3 At least part of steps 5, 6, 8, 9, 10, 13, and 14 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these sub-steps or stages is not necessarily one by one, but can be performed alternately or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0167] It should be noted that Figure 3 , 5 , 6, 8, 10, and the sequence numbers of some steps in the flowcharts Figure 2 The sequence numbers of some steps in the flowchart are consistent, indicating that Figure 3 , 5 The specific implementation methods of these steps in the flowcharts of 6, 8, and 10 are as follows Figure 2 The specific implementation method of the corresponding steps in the flowchart is implemented, and the specific details will not be repeated in this application.
[0168] like Fig.16 As shown, in one embodiment, a file downloading device 1600 is provided, the device 1600 includes: an instruction receiving module 1602, an information obtaining module 1604, an identification sending module 1606, a download progress receiving module 1608, a download progress sending module 1610 and a file sending module 1612, wherein:
[0169] The instruction receiving module 1602 is used to receive a foreground operation trigger instruction and enter the foreground operation state according to the foreground operation trigger instruction.
[0170] The information acquisition module 1604 is used to acquire file download information if it is in the foreground running state; the file download information carries a file identifier and a client application identifier.
[0171] The identification sending module 1606 is used to send the file identification to the client application corresponding to the client application identification; the client application is used to obtain the file download progress corresponding to the file identification.
[0172] The download progress receiving module 1608 is used to receive the file download progress returned by the client application.
[0173] The download progress sending module 1610 is used to send the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file.
[0174] The file sending module 1612 is used to receive the file returned by the server and send the file to the client application.
[0175] In one embodiment, the information acquisition module 1604 is also used to acquire file download information from an internal database; the internal database stores the file download information sent by the client application.
[0176] In one embodiment, the file downloading device 1600 specifically further includes: a download information storage module.
[0177] The download information storage module is used to receive file download information sent by the client application; if the client application is in the foreground running state and detects that there is currently a download task, it generates a file download request, sends the file download request to the server, receives the file download information returned by the server based on the file download request; and stores the file download information in the internal database.
[0178] In one embodiment, the information acquisition module 1604 is further used to send a preset query request to the client application; the preset query request is used to trigger the client application to obtain file download information; and receive the file download information returned by the client application.
[0179] In one embodiment, the identification sending module 1608 is also used to generate a file download progress acquisition request based on the file identification; send the file download progress acquisition request to the client application corresponding to the client application identification; the file download progress acquisition request is used to trigger the client application to obtain the file download progress corresponding to the file identification.
[0180] In one embodiment, the download progress sending module 1610 is also used to determine the identifier of the file to be downloaded according to the file download progress; send the identifier of the file to be downloaded to the server; the server is used to obtain the file to be downloaded corresponding to the identifier of the file to be downloaded, divide the file to be downloaded into at least two block files, and download each block file according to a preset download order.
[0181] In one embodiment, the file downloading device 1600 specifically further includes: a file verification module.
[0182] The file verification module is used to verify the file.
[0183] In one embodiment, the file sending module 1612 is further configured to send the file to the client application if the file verification passes.
[0184] In one embodiment, the file carries a corresponding first verification code; the file verification module is also used to obtain a preset verification code statistical instruction; the file is counted according to the preset verification code statistical instruction to obtain the file's verification code as the file's second verification code; if the first verification code matches the second verification code, it is confirmed that the file verification has passed.
[0185] In one embodiment, the file sending module 1612 is also used to encrypt the file according to a preset first key to obtain an encrypted file; send the encrypted file and the preset first key to the client application; the client application is used to send the key identifier corresponding to the preset first key to the server, receive the second key corresponding to the key identifier returned by the server, decrypt the encrypted file according to the second key to obtain the file; the second key matches the preset first key.
[0186] In one embodiment, the file downloading device 1600 further includes: a receiving module.
[0187] The receiving module is used to receive the updated file download progress returned by the client application; the client application is used to update the file download progress according to each received file to obtain the updated file download progress.
[0188] In one embodiment, the download progress sending module 1610 is further used to send the updated file download progress to the server; the updated file download progress is used to trigger the server to download the corresponding file.
[0189] The specific definition of the file downloading device can be found in the definition of the file downloading method above, which will not be repeated here. Each module in the above-mentioned file downloading device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0190] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.17 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a file download method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0191] Those skilled in the art will understand that Fig.17 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0192] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0193] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0194] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0195] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0196] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A file downloading method, comprising: The client application starts the file download task. When the client application is switched to the background, the file download is suspended. The service application receives a foreground operation trigger instruction and enters a foreground operation state according to the foreground operation trigger instruction. A plurality of applications are installed in the mobile terminal. A trusted application that can provide a file download function is called a service application, and an application that needs to download a file is called a client application. If it is in the foreground running state, then obtaining the file download information of the client application that is switched to the background running; the file download information carries the file identifier and the client application identifier; The file identifier is sent to the client application corresponding to the client application identifier; the client application is used to obtain the file download progress corresponding to the file identifier; Receiving the file download progress returned by the client application; Sending the file download progress to the server; The file download progress is used to trigger the server to download the corresponding file; receiving the file returned by the server, and sending the file to the client application; If the entire file has not been downloaded yet and the service application is switched to the background, the download task of the service application ends; if another service application is in the foreground, the above steps are repeated until the file is downloaded.
2. The method according to claim 1, characterized in that The obtaining of file download information includes: The file download information is obtained from an internal database; the internal database stores the file download information sent by the client application.
3. The method according to claim 2, characterized in that Before the service application receives the foreground running trigger instruction and enters the foreground running state according to the foreground running trigger instruction, the method further includes: receiving the file download information sent by the client application; if the client application is in a foreground running state and detects that there is a current download task, generating a file download request, sending the file download request to the server, and receiving the file download information returned by the server according to the file download request; The file download information is stored in the internal database.
4. The method according to claim 1, characterized in that: The acquiring of file download information of the client application that is switched to background operation also includes: Sending a preset query request to the client application; the preset query request is used to trigger the client application to obtain the file download information; Receive the file download information returned by the client application.
5. The method according to claim 1, characterized in that The sending of the file identifier to the client application corresponding to the client application identifier includes: Generate a file download progress acquisition request according to the file identifier; The file download progress acquisition request is sent to the client application corresponding to the client application identifier; the file download progress acquisition request is used to trigger the client application to acquire the file download progress corresponding to the file identifier.
6. The method according to claim 1, characterized in that The sending the file download progress to the server includes: Determine the identifier of the file to be downloaded according to the file download progress; The to-be-downloaded file identifier is sent to the server; the server is used to obtain the to-be-downloaded file corresponding to the to-be-downloaded file identifier, divide the to-be-downloaded file into at least two block files, and download each of the block files according to a preset download order.
7. The method according to claim 1, characterized in that Before sending the file to the client application, the method further comprises: Verifying said documents; The sending the file to the client application comprises: If the file verification passes, the file is sent to the client application.
8. The method according to claim 7, characterized in that The file carries a corresponding first verification code; The verifying of the file includes: Get the preset verification code statistics instruction; Performing statistics on the file according to the preset verification code statistics instruction to obtain the verification code of the file as the second verification code of the file; If the first verification code matches the second verification code, it is confirmed that the file verification has passed.
9. The method according to claim 1, characterized in that: The sending the file to the client application comprises: Encrypting the file according to a preset first key to obtain an encrypted file; The encrypted file and the preset first key are sent to the client application; the client application is used to send the key identifier corresponding to the preset first key to the server, receive the second key corresponding to the key identifier returned by the server, decrypt the encrypted file according to the second key to obtain the file; the second key matches the preset first key.
10. The method according to any one of claims 1 to 9, characterized in that: The method further comprises: Receiving the updated file download progress returned by the client application; the client application is used to update the file download progress according to each of the received files to obtain the updated file download progress; The sending the file download progress to the server includes: The updated file download progress is sent to the server; the updated file download progress is used to trigger the server to download the corresponding file.
11. A file downloading device, characterized in that: The device comprises: The instruction receiving module is used to start the file download task through the client application. When the client application is switched to the background operation, the file download is suspended. The foreground operation trigger instruction is received through the service application, and the foreground operation state is entered according to the foreground operation trigger instruction. There are multiple applications installed in the mobile terminal. The trusted application that can provide the file download function is called the service application, and the application that needs to download the file is called the client application. An information acquisition module, used for acquiring file download information of the client application switched to background operation if the client application is in the foreground operation state; the file download information carries a file identifier and a client application identifier; An identification sending module, used for sending the file identification to the client application corresponding to the client application identification; the client application is used for obtaining the file download progress corresponding to the file identification; A download progress receiving module, used for receiving the file download progress returned by the client application; A download progress sending module, used to send the file download progress to the server; the file download progress is used to trigger the server to download the corresponding file; A file sending module, used for receiving the file returned by the server and sending the file to the client application; The processing module is used to terminate the download task of the service application if the entire file has not been downloaded and the service application is switched to the background; if another service application is in the foreground, the above module is repeatedly executed until the file is downloaded.
12. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 10.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Method and system for downloading file
CN103401931A