CN108965407A - A kind of processing implementation method of mobile Internet file download - Google Patents
A kind of processing implementation method of mobile Internet file download Download PDFInfo
- Publication number
- CN108965407A CN108965407A CN201810706833.8A CN201810706833A CN108965407A CN 108965407 A CN108965407 A CN 108965407A CN 201810706833 A CN201810706833 A CN 201810706833A CN 108965407 A CN108965407 A CN 108965407A
- Authority
- CN
- China
- Prior art keywords
- task
- downloading
- download
- mobile internet
- implementation method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/75—Indicating network or usage conditions on the user display
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention discloses a kind of processing method of mobile Internet file download, include the following steps: step S1, Initialize installation, active user is set, to distinguish the task of different user, whether setting supports breakpoint transmission function, the local path of setting downloading file storage;Step S2, task queue is added after needing downloading for task, task that will be packaged in addition, and monitors task download progress and download and the states such as finish or malfunction;The stateful update of step 3, task will notify monitor and database be written in state, guarantee that user perceives the last state of each task;Step 4, task downloading complete that file path will be returned and remove the task in the state of database, and so far, a task downloading is completed.The present invention is using SQLite as data record storage medium, in conjunction with the concept of real-time stream, the method for realizing a set of general, real-time, efficient management Multi-User Multi-Task downloading.
Description
Technical field
The present invention discloses a kind of processing method of mobile Internet file download, more specifically, being related to one kind in movement
The processing method that Multi-User Multi-Task is downloaded in equipment.
Background technique
Android is the mobility device of an intelligence, has been subjected to 10 years or so courses so far from its birth,
The version of this Android in 10 years has changed a lot.Wherein the file download in Android platform has also lived through 3
In a main period, first period is the initial stage being born in Android, before Android API level 8, in file
Downloading this block android system relatively good implementation method is not provided, general way is that developer goes transplanting to encapsulate
It is used in the method to Android platform of JavaWEB platform.Although this way can download general file,
Disadvantage is obvious, and mainly stability is not good enough, and followed by multifile management is hard.Second period is in Android API
Between level 9 to Android API level 14, android system is provided when 9 level Android API
File download manager DownloadManager, the release of the function is so that the download function of file greatly simplifies, and only need are simple
Several line codes can complete the downloading of a file, and support breakpoint transmission and notification bar show download progress function,
The way for the file download manager that android system provides is another that the downloading task of APP has been given to system in fact
APP goes to manage, and it is next to APP opaque that disadvantage of this is that downloading tasks, and control is got up very not flexible.Third period and
Two some overlappings of period, the main distinction is the rise that many third parties download frame, such as okhttp, android-async-
Http, volley etc., this kind of frame are not mainly for file download, but complete http communicates frame, and file download is
The subsidiary a part in the inside also can satisfy general file download function, but be also not for the problems such as management of multifile
File enough convenient and that multi-user can not be managed.
Summary of the invention
For the disadvantage that android system in the prior art mentioned above is not convenient enough to multifile download management,
The present invention provides a kind of processing implementation method of mobile Internet file download, stores using using SQLite as data record
Medium, in conjunction with real-time stream concept, it can be achieved that it is wieldy, be suitable for each API level version of Android platform
Multi-User Multi-Task downloading implementation method.
The technical solution used to solve the technical problems of the present invention is that: a kind of processing realization of mobile Internet file download
Method, this method include the following steps:
Step S1, active user is arranged in Initialize installation, and to distinguish the task of different user, whether setting supports breakpoint
Resume function, the local path of setting downloading file storage;
Step S2, task queue is added after needing downloading for task, task will be packed in addition, and monitors task and be downloaded into
It spends and downloads and the states such as finish or malfunction;
Step S3, the stateful update of task will notify monitor and database be written in state;
Step S4, task downloading completes that file path will be returned and removes the task in the state of database, a task
I.e. downloading is completed.
The technical scheme adopted by the invention to solve the technical problem further comprises:
When the described step S1 Initialize installation, include the following steps:
The first step configures DownLoadService in androidmanifest.xml;
Second step starts DownLoadServicestartService in onCreate () function of Application
(new Intent(this,DownLoadService.class));
Third step sets user information and whether server supports breakpoint transmission.
The step S1 point of interruption resumes function and loading source is needed to support breakpoint transmission function, as loading source is not supported to break
Point resumes, then the setting is invalid.
The local path of setting downloading file storage in the step S1, the file downloaded after local path, which will be arranged, to be protected
It is stored in the path of setting, is such as not provided with file download path, then downloads to the path of default.
When the task that addition needs to download in the step S2, include the following steps:
The first step, addition downloading task;
Second step adds task status monitoring for corresponding task.
Downloading task is added in the step S2 gives the task to distribute unique task ID simultaneously, it is subsequent to the task into
When row operation, corresponding operation is searched and carried out according to task ID.
When adding downloading task in the step S2, it can check whether the task has existed or whether downloaded
At, as it is existing or downloaded completion if do not re-download.
Added task will be put into a queue in the step S2, and download service is opened a thread pool and is used for
Task downloading, downloading task start to download according to the sequencing of addition, once there is connection time-out in some task, then by this
Business is put to tail of the queue, downloading of requeuing.
When the state of each task changes in the step S3, number can be all recorded in download progress and related data
According to library, and progress msg is pushed to the user of download module.
Task, which is downloaded, in the step S4 completes to return file path and by the task from downloading queue removing and clearly
Except the task is in the state of database.
The beneficial effects of the present invention are: applicability of the invention is wide, and it is easy to use, after starting service, only need simple several
A step is that can reach the purpose of management Multi-User Multi-Task downloading.The present invention is using light-weight database Sqlite as task
The storage medium of real-time status data occupies the feature that resource is small, processing speed is fast using Sqlite, in real time by each task
State accurately notify user.
Below in conjunction with the drawings and specific embodiments, the present invention will be further described.
Detailed description of the invention
Fig. 1 is basic flow chart of the invention.
Fig. 2 is the flow chart of application example of the present invention.
Specific embodiment
The present embodiment is the preferred embodiment for the present invention, other its all principles and basic structure are identical or close as the present embodiment
As, within that scope of the present invention.
The technical solution of the present invention is to provide a kind of implementation methods of mobile Internet file download, please refer to attached drawing 1, this
Implementation method in invention includes the following steps:
Step S1, Initialize installation: setting active user, to distinguish the task of different user, whether setting supports breakpoint
Resume function, the local path of setting downloading file storage.In the present embodiment, setting active user is for guaranteeing in multiple users
Which user the file that downloading can be distinguished when downloading file using download module belongs to, and the same time can only be under user's use
Module is carried, a user can download multiple tasks simultaneously.In the present embodiment, the local path of setting downloading file storage, setting
The file downloaded after local path will be stored in the path of setting, such as be not provided with file download path, then downloads to the road of default
Diameter.
In the present embodiment, concrete operations are as follows:
The first step configures DownLoadService < service android in androidmanifest.xml:
Name=" filedownloader.download.DownLoadService "/>
Second step starts DownLoadService in onCreate () function of Application
startService(new Intent(this,DownLoadService.class));
Third step sets user information and whether server supports breakpoint transmission, in the present embodiment, breakpoint transmission function
Loading source is needed to support breakpoint transmission function, if loading source does not support breakpoint transmission, then the setting is invalid.
Step S2, addition needs downloading for task: task queue is added after being packaged in task, and monitors task and be downloaded into
It spends and downloads and the states such as finish or malfunction.In the present embodiment, addition downloading task need to distribute unique appoint simultaneously to the task
Be engaged in ID, subsequent when being operated (such as pause is cancelled) to the task, and corresponding operation is searched and carried out according to task ID.
In the present embodiment, it can check whether the task has existed or whether downloaded completion when adding downloading task, it is such as existing
Or it downloads completion and has not re-downloaded then.It will be put into a queue in added task, a line is opened in download service
Cheng Chi is downloaded for task, and downloading task starts to download according to the sequencing of addition, once there is connection time-out in some task,
Then the task is put to tail of the queue, downloading of requeuing.
In the present embodiment, concrete operations are as follows:
The first step, addition downloading task
Second step adds task status monitoring for corresponding task
Step S3, the stateful update of task will notify monitor and database be written in state, guarantee that user's perception is each
The last state of task.In the present embodiment, when the state of each task changes, download progress and related data can all be recorded
To database, and progress msg is pushed to the user of download module, guarantees that user perceives each task at the first time
Last state.
It is main to realize that logical code is as follows in the present embodiment:
Step S4, task downloading completes that file path will be returned and removes the task in the state of database, so far, one
Task downloading is completed, in the present embodiment, task downloading complete will to return file path and the task is removed from downloading queue and
The task is removed in the state of database.
In the present embodiment, it is implemented as follows:
Each task can realize DownLoadSuccess interface, and task downloading is completed to be notified that down after realizing the interface
Manager is carried, and download manager receives the message that task downloading can be completed after the message that a certain task downloading is completed and pushes
To monitor, then the task is removed from download manager.Here is the definition of DownLoadSuccess interface:
Applicability of the invention is wide, easy to use, after starting service, only needs simple several steps to can reach management more
The purpose of user's multitask downloading.The present invention is situated between using light-weight database Sqlite as the storage of task real-time status data
Matter occupies the feature that resource is small, processing speed is fast using Sqlite, in real time accurately notifies the state of each task to use
Family.
Claims (10)
1. a kind of processing implementation method of mobile Internet file download, it is characterized in that: the method includes the following steps:
Step S1, active user is arranged in Initialize installation, and to distinguish the task of different user, whether setting supports breakpoint transmission
Function, the local path of setting downloading file storage;
Step S2, addition needs the downloading of the task, task will it is packed after task queue is added, and monitor task download progress with
And it downloads and the states such as finishes or malfunction;
Step S3, the stateful update of task will notify monitor and database be written in state;
Step S4, task downloading completes that file path will be returned and removes the task in the state of database, under a task is
It carries and completes.
2. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
When S1 Initialize installation, include the following steps:
The first step configures DownLoadService in androidmanifest.xml;
Second step starts DownLoadService startService in onCreate () function of Application
(new Intent(this,DownLoadService.class));
Third step sets user information and whether server supports breakpoint transmission.
3. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
The S1 point of interruption resumes function and loading source is needed to support breakpoint transmission function, if loading source does not support breakpoint transmission, then the setting nothing
Effect.
4. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
The local path of setting downloading file storage, is arranged the path that the file downloaded after local path will be stored in setting, such as in S1
It is not provided with file download path, then downloads to the path of default.
5. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
When the task that addition needs to download in S2, include the following steps:
The first step, addition downloading task;
Second step adds task status monitoring for corresponding task.
6. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
Downloading task is added in S2 gives the task to distribute unique task ID simultaneously, subsequent when operating to the task, according to task
ID is searched and is carried out corresponding operation.
7. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
When adding downloading task in S2, it can check whether the task has existed or whether downloaded completions, as existing or
Downloading is completed not re-download then.
8. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
Added task will be put into a queue in S2, and download service is opened a thread pool and downloaded for task, downloading task
Start to download according to the sequencing of addition, once connection time-out occurs in some task, then the task is put to tail of the queue, arranged again
Team's downloading.
9. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
When the state of each task changes in S3, download progress and related data can all be recorded database, and by progress msg
It is pushed to the user of download module.
10. the processing implementation method of mobile Internet file download according to claim 1, it is characterized in that: the step
Task downloading completes that file path will be returned and removes and remove the task in database the task from downloading queue in rapid S4
State.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810706833.8A CN108965407A (en) | 2018-07-02 | 2018-07-02 | A kind of processing implementation method of mobile Internet file download |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810706833.8A CN108965407A (en) | 2018-07-02 | 2018-07-02 | A kind of processing implementation method of mobile Internet file download |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108965407A true CN108965407A (en) | 2018-12-07 |
Family
ID=64484755
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810706833.8A Pending CN108965407A (en) | 2018-07-02 | 2018-07-02 | A kind of processing implementation method of mobile Internet file download |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108965407A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109729165A (en) * | 2018-12-28 | 2019-05-07 | 国云科技股份有限公司 | A kind of system and method for realizing file download using local cache strategy |
CN112491938A (en) * | 2019-09-11 | 2021-03-12 | 深圳艾派网络科技股份有限公司 | JavaFX-custom-based object storage uploading and downloading method |
CN114157655A (en) * | 2021-11-26 | 2022-03-08 | 杭州安恒信息安全技术有限公司 | Task downloading method, system, computer equipment and readable storage medium |
CN114442902A (en) * | 2020-10-19 | 2022-05-06 | 深圳艾派网络科技股份有限公司 | Object storage breakpoint resume method and system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2856489A1 (en) * | 2003-06-23 | 2004-12-24 | Bouygues Telecom Sa | METHOD OF DOWNLOADING FILES ON MOBILE EQUIPMENT |
CN104462400A (en) * | 2014-12-10 | 2015-03-25 | 北京奇虎科技有限公司 | Method, device and browser client for downloading files in mobile terminals |
CN106445665A (en) * | 2016-09-19 | 2017-02-22 | 武汉斗鱼网络科技有限公司 | Method and tool for system file downloading applied to android system |
-
2018
- 2018-07-02 CN CN201810706833.8A patent/CN108965407A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2856489A1 (en) * | 2003-06-23 | 2004-12-24 | Bouygues Telecom Sa | METHOD OF DOWNLOADING FILES ON MOBILE EQUIPMENT |
CN104462400A (en) * | 2014-12-10 | 2015-03-25 | 北京奇虎科技有限公司 | Method, device and browser client for downloading files in mobile terminals |
CN106445665A (en) * | 2016-09-19 | 2017-02-22 | 武汉斗鱼网络科技有限公司 | Method and tool for system file downloading applied to android system |
Non-Patent Citations (1)
Title |
---|
ZHUIJI7: "SherlockHomeFileDownloader Android下载框架,支持多用户、多任务、断点续传", 《GITHUB》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109729165A (en) * | 2018-12-28 | 2019-05-07 | 国云科技股份有限公司 | A kind of system and method for realizing file download using local cache strategy |
CN112491938A (en) * | 2019-09-11 | 2021-03-12 | 深圳艾派网络科技股份有限公司 | JavaFX-custom-based object storage uploading and downloading method |
CN112491938B (en) * | 2019-09-11 | 2023-04-07 | 深圳艾派网络科技股份有限公司 | JavaFX-custom-based object storage uploading and downloading method |
CN114442902A (en) * | 2020-10-19 | 2022-05-06 | 深圳艾派网络科技股份有限公司 | Object storage breakpoint resume method and system |
CN114157655A (en) * | 2021-11-26 | 2022-03-08 | 杭州安恒信息安全技术有限公司 | Task downloading method, system, computer equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108965407A (en) | A kind of processing implementation method of mobile Internet file download | |
US10938954B2 (en) | Method and system for mobile applications update in the cloud | |
Brahler | Analysis of the android architecture | |
CN110603527B (en) | Method, system and apparatus for conditional debugging of server-side production code | |
CN103645914B (en) | Software cleaning method and device | |
CN105765534A (en) | Virtual computing systems and methods | |
US10394580B2 (en) | Dynamic addition and removal of operating system components | |
KR20130138635A (en) | Method and apparatus for fault tolerant fota update with single backup block write | |
CN107710215A (en) | The method and apparatus of mobile computing device safety in test facilities | |
CN104205109A (en) | Persistent and resilient worker processes | |
US20170168807A1 (en) | Method and electronic device for updating application program | |
CN109002320B (en) | Updating method, system, electronic device and storage medium for software development kit | |
US20150012732A1 (en) | Method and device for recombining runtime instruction | |
JP2009521746A (en) | Program execution service window | |
CA2691306A1 (en) | Interdependent task management | |
CN113961346A (en) | Data cache management and scheduling method and device, electronic equipment and storage medium | |
US20180011697A1 (en) | Reusable deployment plans and dependencies thereof | |
CN104063225A (en) | Locked screen theme development method and locked screen theme development system | |
US9817671B2 (en) | Rule-based activation of behaviors in an extensible software application | |
CN105094791A (en) | Status bar notification storage method and status bar notification storage device | |
CN104461623A (en) | Method and device for running application program | |
US20150067701A1 (en) | Creating a custom series of commands | |
CN108132832B (en) | Application program starting method and device | |
CN104750553B (en) | Using operation method and device | |
CN108566417A (en) | A kind of multithread breakpoint continued transmission download system based on android system and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181207 |
|
RJ01 | Rejection of invention patent application after publication |