The keepalive method and device of background service processTechnical field
The present invention relates to computer realm, in particular to the keepalive method and device of a kind of background service process.
Background technology
Analysis finds that background service process is low due to priority, is easily killed by system or third party software, thus easilyAccidental interruption is restarted, and process accidental interruption or is restarted, and can cause harmful effect to business such as data-pushing or downloads.
Analysis also finds that easily killed main cause has 2 to background service process, respectively:(1) background service entersThe priority of journey is low, and using the system of object-oriented method (Object-Oriented Method, referred to as OOM) mechanism(such as android system), the low process of priority can be automatically killed when internal memory is critical, and ensured with vacateing enough spaces excellentThe high process of first level is normally run;(2) user, especially Android user, can consciously clear up background application mostly(i.e. background service process), and can provide easily backstage system (such as android system) or third party's cleaning softwareUsing a key clearing function.
For farthest keep-alive background service process, at present, the popular application of some major companies generally adopts following 2Plant way:(1) after process is killed, restarted using independent finger daemon and entered journey, or adjusted using third party softwareJourney is entered, or journey is entered using the wake-up such as system alarm clock, static broadcast;(2) due to the priority of foreground service processesHigher than the priority of background service process, thus sightless background service process is set into visible foreground service processes,To improve the priority of process, so as to anti-locking system or third party software kill too early process, to realize that background service process is protectedPurpose living.
Wherein, for method (1), the after death simply many chances being activated again of process can not substantially reach guarantorPurpose living;For method (2), although keep-alive purpose can be admirably achieved, but when foreground service processes are arranged, systemAPI necessarily may require that foreground service processes binding informing is notified at one.For the notice, on the one hand, Yong HuwuMethod directly removes this notice, and this can cause most of user to dislike;On the other hand, user is by using hands such as third party softwaresWhen section removes the notice, foreground service processes will necessarily be cancelled, cancel foreground service processes and be equal to kill corresponding backstageService processes.
For the problems referred to above, effective solution is not yet proposed at present.
The content of the invention
The keepalive method and device of a kind of background service process are embodiments provided, at least to solve correlation techniqueIt is middle by foreground service processes be individually bundled in one notify on, cause remove the notice will necessarily cancel therewith have binding relationshipForeground service processes, and then cause background service process corresponding with the foreground service processes will necessarily killed technology askTopic.
A kind of one side according to embodiments of the present invention, there is provided keepalive method of background service process, including:ObtainForeground transient service process, wherein, above-mentioned foreground transient service process is obtained by backstage transient service process configuration, and onState foreground transient service process and foreground resident service process and be bundled in one and notify, above-mentioned foreground resident service process be byWhat backstage resident service process configuration was obtained, above-mentioned notice is used to point out above-mentioned foreground transient service process and above-mentioned foreground residentService processes are just in front stage operation, and the priority of above-mentioned foreground resident service process is excellent higher than above-mentioned backstage resident service processFirst level;Close above-mentioned foreground transient service process;The above-mentioned notice that removing binds together with above-mentioned foreground transient service process.
Another aspect according to embodiments of the present invention, additionally provides a kind of keep-alive device of background service process, including:ObtainUnit is taken, for obtaining foreground transient service process, wherein, above-mentioned foreground transient service process is by backstage transient service processConfigure what is obtained, and above-mentioned foreground transient service process is bundled in one and notifies with foreground resident service process, above-mentioned foregroundResident service process is obtained by backstage resident service process configuration, and above-mentioned notice is used to point out above-mentioned foreground transient service to enter, just in front stage operation, the priority of above-mentioned foreground resident service process is higher than above-mentioned backstage for journey and above-mentioned foreground resident service processThe priority of resident service process;First closing unit, for closing above-mentioned foreground transient service process;Clearing cell, is used forThe above-mentioned notice that removing binds together with above-mentioned foreground transient service process.
In embodiments of the present invention, adopt and the two foreground service processes for obtaining are respectively configured by two background service processesThe mode being bundled in same notice, by obtaining foreground transient service process, wherein, foreground transient service process is by rearThe configuration of platform transient service process is obtained, and foreground transient service process is bundled in a notice with foreground resident service processOn, foreground resident service process is obtained by backstage resident service process configuration, is notified for pointing out foreground transient service to enter, just in front stage operation, the priority of foreground resident service process is higher than backstage resident service process for journey and foreground resident service processPriority;Close foreground transient service process;The notice bound together with foreground transient service process is removed, after keep-alivePlatform service processes, due to closing transient service process after system can remove bind together therewith logical from informing automaticallyKnow, and after notifying to be cancelled, user is just difficult to discover the resident service process with high priority in front stage operation, only furtherGround, user be detectable resident service process be currently running would not active killing this (or these) process, thus reachSacrifice transient service process with prevent user's active killing just with high priority the resident service process of front stage operation mesh, it is achieved thereby that keep-alive just with high priority in the technique effect of the resident service process of front stage operation, and then solve phaseIn the technology of pass by foreground service processes be individually bundled in one notify on, cause remove the notice will necessarily cancel therewith have tie upDetermine the foreground service processes of relation, and then cause the background service process corresponding with the foreground service processes will necessarily be killedTechnical problem.
Description of the drawings
Accompanying drawing described herein is used for providing a further understanding of the present invention, constitutes the part of the application, thisBright schematic description and description does not constitute inappropriate limitation of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is a kind of hardware configuration frame of the terminal of the keepalive method of background service process of the embodiment of the present inventionFigure;
Fig. 2 is the flow chart of the keepalive method of a kind of optional background service process according to embodiments of the present invention;
Fig. 3 is the logic relation picture of a kind of optional AM/BAM service processes according to embodiments of the present invention;
Fig. 4 is the schematic diagram of the keep-alive device of a kind of optional background service process according to embodiments of the present invention.
Specific embodiment
In order that those skilled in the art more fully understand the present invention program, below in conjunction with the embodiment of the present inventionAccompanying drawing, is clearly and completely described to the technical scheme in the embodiment of the present invention, it is clear that described embodiment is onlyThe embodiment of a part of the invention, rather than the embodiment of whole.Based on the embodiment in the present invention, ordinary skill peopleThe every other embodiment that member is obtained under the premise of creative work is not made, should all belong to the model of present invention protectionEnclose.
It should be noted that description and claims of this specification and the term " first " in above-mentioned accompanying drawing, "Two " it is etc. the object for distinguishing similar, without for describing specific order or precedence.It should be appreciated that so usingData can exchange in the appropriate case, so as to embodiments of the invention described herein can with except illustrating here orOrder beyond those of description is implemented.Additionally, term " comprising " and " having " and their any deformation, it is intended that coverLid is non-exclusive to be included, and for example, process, method, system, product or the equipment for containing series of steps or unit is not necessarily limited toThose steps clearly listed or unit, but may include clearly not list or for these processes, method, productOr intrinsic other steps of equipment or unit.
Embodiment 1
According to embodiments of the present invention, a kind of embodiment of the keepalive method of background service process is additionally provided, explanation is needed, can hold in the such as computer system of one group of computer executable instructions the step of the flow process of accompanying drawing is illustratedOK, and, although show logical order in flow charts, but in some cases, can be with different from order hereinPerform shown or described step.
The embodiment of the method that the embodiment of the present application one is provided can be in mobile terminal, terminal or similar fortuneCalculate in device and perform.As a example by running on computer terminals, Fig. 1 is a kind of guarantor of background service process of the embodiment of the present inventionThe hardware block diagram of the terminal of activating method.As shown in figure 1, terminal 10 can include one or more (figuresIn only illustrate one) (processor 102 can include but is not limited to Micro-processor MCV or PLD to processor 102The processing meanss of FPGA etc.), the memory 104 for data storage and the transport module 106 for communication function.AbilityDomain those of ordinary skill is appreciated that the structure shown in Fig. 1 is only illustrated, and it does not cause limit to the structure of above-mentioned electronic installationIt is fixed.For example, terminal 10 may also include more more than shown in Fig. 1 or less components, or with shown in Fig. 1 notSame configuration.
Memory 104 can be used to store the software program and module of application software, the such as backstage in the embodiment of the present inventionCorresponding programmed instruction/the module of keepalive method of service processes, processor 102 is stored in soft in memory 104 by operationPart program and module, so as to perform various function application and data processing, that is, realize the leak inspection of above-mentioned application programSurvey method.Memory 104 may include high speed random access memory, may also include nonvolatile memory, such as one or more magneticProperty storage device, flash memory or other non-volatile solid state memories.In some instances, memory 104 can be further includedRelative to the remotely located memory of processor 102, these remote memories can be by network connection to terminal 10.The example of above-mentioned network includes but is not limited to internet, intranet, LAN, mobile radio communication and combinations thereof.
Transmitting device 106 is used to that data to be received or sent via a network.Above-mentioned network instantiation may includeThe wireless network that the communication providerses of terminal 10 are provided.In an example, transmitting device 106 includes that a network is fittedOrchestration (Network Interface Controller, NIC), it can be connected so as to can be with by base station with other network equipmentsInternet is communicated.In an example, transmitting device 106 can be radio frequency (Radio Frequency, RF) module, itsFor wirelessly being communicated with internet.
Under above-mentioned running environment, this application provides the keepalive method of background service process as shown in Figure 2.Fig. 2 isThe flow chart of the keepalive method of a kind of optional background service process according to embodiments of the present invention, as shown in Fig. 2 the method bagInclude following steps:
Step S202, obtains foreground transient service process, wherein, foreground transient service process is entered by backstage transient serviceJourney configuration is obtained, and is bundled in a notice with foreground resident service process, and foreground resident service process is normal by backstageWhat configuration in service processes was obtained, notify for pointing out foreground transient service process and foreground resident service process just to transport on foregroundOK, priority of the priority of foreground resident service process higher than backstage resident service process;
Step S204, closes foreground transient service process;
Step S206, removes the notice bound together with foreground transient service process, with keep-alive background service process.
That is, the transient service process and resident service process that operate in backstage are configured to before corresponding operating in respectivelyThe transient service process and resident service process of platform, and the transient service process and resident service process binding on foreground will be operated inOne be used for point out user have which just front stage operation service processes notice, so, if cancel transient serviceThe front stage operation state of process, system will remove the notice for binding together therewith from informing automatically, in such caseUnder, due to having been cleared by with the notice of foreground resident service process binding, thus user is difficult to aware system actually justIn operation foreground resident service process (i.e. resident service process in foreground also lives), so as to will not the resident clothes in the active killing foregroundBusiness process, corresponding backstage resident service process also will not be fallen by killing, that is, close foreground transient service process and remove correspondenceNotice, resident service will not be affected, can normally run on foreground, not only maintain resident service processThe high priority of front stage operation state, and because the notice bound therewith is closed for these reasons, now user is difficultAlso in front stage operation with discovering resident service, thus typically will not actively clear up this or these resident service, on the one hand, afterPlatform service processes are configured to priority after the service processes of foreground and improve, on the other hand, for pointing out the background service processThe notice run with foreground running status is also removed by transient service process, thus user will not discover and actively removeThe background service process, has reached the life-span i.e. technique effect of keep-alive background service process for extending background service process.
It should be noted that in embodiments of the present invention, it is right in the following manner can be configured to background service processThe foreground service processes configuration answered:It is configured to so that backstage transient service process is configured into corresponding foreground transient service processExample, during enforcement, can first state and start backstage transient service process, recall system API " startForegruond " to incite somebody to actionBackstage transient service process is set to foreground transient service process;It is normal so that backstage resident service process is configured into corresponding foregroundAs a example by configuration in service processes, during enforcement, can first start backstage resident service process, recall system API" startForegruond " by backstage resident service process being set to foreground resident service process.Wherein, AM/BAM service intoThe logical relation of journey is as shown in Figure 3.Because foreground transient service process and foreground resident service process are all bundled in a noticeOn, so, by closing foreground transient service process come clear above-mentioned notice, user be difficult to discovery system be currently running it is above-mentioned" foreground resident service process ", thus will not active killing " foreground resident service process ", so as to reached by foreground it is interimService processes understand corresponding notice with the purpose of keep-alive foreground resident service process.
In embodiments of the present invention, adopt and the two foreground service processes for obtaining are respectively configured by two background service processesThe mode being bundled in same notice, by obtaining foreground transient service process, wherein, foreground transient service process is by rearThe configuration of platform transient service process is obtained, and is bundled in a notice with foreground resident service process, and foreground resident service entersJourney is obtained by backstage resident service process configuration, is notified for pointing out foreground transient service process and foreground resident service to enterJust in front stage operation, the priority of foreground resident service process is higher than the priority of backstage resident service process to journey;Close foregroundTransient service process;The notice bound together with foreground transient service process is removed, with keep-alive background service process, due to closingClosing system after transient service process can remove the notice for binding together therewith from informing automatically, and notify to be cancelled itAfterwards, user is just difficult to discover the resident service process with high priority in front stage operation, and only further, user has been detectableResident service process be currently running would not active killing this (or these) process, thus reached sacrifice transient service processWith prevent user's active killing just with high priority the resident service process of front stage operation purpose, it is achieved thereby that keep-alive is justWith high priority the resident service process of front stage operation technique effect, and then solve in correlation technique by foreground service intoJourney be individually bundled in one notify on, cause remove the notice will necessarily cancel therewith with binding relationship foreground service intoJourney, and then cause the background service process corresponding with the foreground service processes will necessarily killed technical problem.
Alternatively, before foreground transient service process is obtained, said method also includes:
S2, starts backstage resident service process and configures foreground resident service process according to backstage resident service process, withAnd foreground resident service process is bundled in notice;
S4, starts backstage transient service process and configures foreground transient service process according to backstage transient service process, withAnd foreground transient service process is also bundled in notice.
For example, backstage resident service process A of PP assistant is started, and it is normal that the backstage resident service process is set into foregroundIn service processes, and the foreground resident service process is bundled on notice C, while starting transient service process B, this facesWhen service processes B be background process, in order to farthest ensure that platform resident service process A is survived, enter transient service is startedAfter journey B, it is also desirable to be set to foreground service processes, i.e. foreground transient service process, while also by the foreground transient serviceProcess is bundled in above-mentioned notice C, and the front stage operation state of transient service process B is cancelled immediately, that is, cancel foreground transient serviceProcess.Because foreground transient service process is bundled on notice C, and cancel after the transient service process of foreground, Android system can beAutomatically by the removing of above-mentioned notice C in informing.Because whole process is Millisecond, user does not also see foreground in step S204Notice C of resident service process A and foreground transient service process B shows in informing, notifies C just by stepOperation in S206 is removed.Therefore, the embodiment of the present invention passes through this defect for dexterously utilizing system code logic, simplyAnd silently form user's unaware and but have a resident service of front stage operation state, the service make process belonging to it intoFor the visible process in foreground, priority is improve, it is to avoid system is killed too early, so as to reach maximum keep-alive effectReally.
Alternatively, upon actuation before platform transient service process, said method also includes:
S6, defines an empty service processes;
S8, the empty service processes of statement are backstage transient service process.
For example, first backstage resident service process A is set into foreground service processes and binds notice C, then stated and startOne backstage transient service process B, and backstage transient service process B is also configured as into foreground service processes and notice C is bound,Such 2 foreground service processes are just bundled in same notice, then call service to close function API" stopService " closes backstage transient service process B to cancel the front stage operation state of backstage transient service process B,Now, Android system can simultaneously dispose notice C bound together with backstage transient service B in informing, but above-mentionedOperation does not interfere with the normal operation of backstage resident service process A, and still can keep backstage resident service process AThe high priority of foreground service, while not having the information of the process in informing, is carrying so as to reach background serviceCan also prevent after high priority by user based on the technique effect for notifying prompting killing, realize the purpose of keep-alive resident service.
In addition, being empty service processes by backstage transient service process definition, i.e., any essence is not provided when the process is runOperation, can simplify whole programming procedure, reduce cost consumption.
Alternatively, included according to backstage resident service process configuration foreground resident service process:Call front stage operation stateOpen function backstage resident service process is configured into foreground resident service process;According to backstage transient service process configuration foregroundTransient service process includes:Call front stage operation state to open function backstage transient service process is configured into foreground transient serviceProcess;Closing foreground transient service process includes:Call front stage operation state to close function, entered with closing foreground transient serviceJourney.
For example, backstage resident service process A is started, calling system API " startForeground " is by backstage resident serviceProcess A is set to foreground resident service process, while foreground resident service process is bundled on notice C;After stating and startingPlatform transient service process B, it is interim that backstage transient service process B is set to foreground by calling system API " startForegruond "Service processes, while foreground transient service process is also bundled on notice C, so, backstage resident service process and backstage are facedWhen service processes be just bundled on same notice C.Accordingly, foreground corresponding with backstage transient service process is cancelled interimDuring service processes, it is possible to which calling system API " stopForeground (true) " cancels the foreground of backstage transient service process BRunning status, that is, cancel foreground transient service process, and now system will be removed and foreground transient service process from informingNotice C of binding.Above-mentioned technical proposal does not interfere with the normal operation of resident service, and has remained in that the resident clothes in backstageThe high priority of the foreground service of business process A, while being not in any prompting of foreground resident service process in informingInformation, has reached and improve in the case of mourning in silence the priority of background service with the technique effect of the keep-alive background service.
Alternatively, before being turned off platform transient service process while, said method also includes:
S10, closes backstage transient service process corresponding with foreground transient service process.
For example, backstage resident service process A is set into foreground service processes and binds notice C, restart a backstageTransient service process B, is also configured as the backstage transient service process B foreground service processes and binds notice C, before such 2Platform service processes are just bundled in same notice, are then cancelled the front stage operation state of backstage transient service process B and are closedBackstage transient service process B is closed, now, Android system can simultaneously disposed and bound with backstage transient service B in informingNotice C together, but aforesaid operations do not interfere with the normal operation of backstage resident service process A, and still can be withThe high priority of the foreground service of backstage resident service process A is kept, while the information of the process is not had in informing,So as to reach raising background service priority of mourning in silence with the technique effect of the corresponding background service of keep-alive.Wherein, it is so-called to mourn in silenceRefer to and target background service is set into foreground service, it is that the visible process in foreground is taken with keep-alive target backstage to improve process priorityBusiness, while need not associate informing carries out notice prompting, can make user's whole process unaware.
Alternatively, closing backstage transient service process corresponding with foreground transient service process includes:
S12, calls background service to close function;
S14, operation background service closes function, is entered with closing backstage transient service corresponding with foreground transient service processJourney.
For example, backstage resident service process A is set into foreground service processes and binds notice C, restart a backstageTransient service process B, is also configured as the backstage transient service process B foreground service processes and binds notice C, before such 2Platform service processes are just bundled in same notice, are then called service to close function API " stopService " and are cancelled backstageThe front stage operation state of transient service process B simultaneously closes backstage transient service process B, and now, Android system can be removed simultaneouslyFall notice C bound together with backstage transient service B in informing, but aforesaid operations do not interfere with backstage and resideThe normal operation of service processes A, and the high priority that the foreground of backstage resident service process A services still can be kept, whileThe information of the process is not had in informing, so as to reached mourn in silence raising background service priority with keep-alive it is corresponding afterThe technique effect of platform service.
It should be noted that the above-mentioned technical proposal of the present invention is in PP assistant's client at Android Application issuance centerPilot scale is used, and result on trial shows that it can make the raising of the survival rate of background service process, prolonged survival period, thus can carryThe stability of the business such as height is pushed, download.
It should be noted that for aforesaid each method embodiment, in order to be briefly described, therefore it is all expressed as a series ofCombination of actions, but those skilled in the art should know, the present invention do not limited by described sequence of movement becauseAccording to the present invention, some steps can adopt other orders or while carry out.Secondly, those skilled in the art also should knowKnow, embodiment described in this description belongs to preferred embodiment, involved action and module is not necessarily of the inventionIt is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned enforcementThe keepalive method of the background service process of example can add the mode of required general hardware platform to realize by software, also may be used certainlyWith by hardware, but in many cases the former is more preferably embodiment.Based on such understanding, technical scheme sheetThe part contributed to prior art in other words in matter can be embodied in the form of software product, and the computer software is producedProduct are stored in a storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions are used so that a station terminal equipmentThe method that (can be mobile phone, computer, server, or network equipment etc.) performs each embodiment of the invention.
Embodiment 2
According to embodiments of the present invention, a kind of dress for implementing the keepalive method of above-mentioned background service process is additionally providedPut, as shown in figure 4, the device includes:Acquiring unit 402, for obtaining foreground transient service process, wherein, foreground takes temporarilyBusiness process is obtained by backstage transient service process configuration, and foreground transient service process and foreground resident service process bindingNotify at one, foreground resident service process is obtained by backstage resident service process configuration, is notified for pointing out foregroundTransient service process and foreground resident service process are just in front stage operation, and the priority of foreground resident service process is normal higher than backstageIn the priority of service processes;First closing unit 404, for closing foreground transient service process;Clearing cell 406, is used forThe notice bound together with foreground transient service process is removed, with keep-alive background service process.
That is, the transient service process and resident service process that operate in backstage are configured to before corresponding operating in respectivelyThe transient service process and resident service process of platform, and the transient service process and resident service process binding on foreground will be operated inOne be used for point out user have which just front stage operation service processes notice, so, if cancel transient serviceThe front stage operation state of process, system will remove the notice for binding together therewith from informing automatically, in such caseUnder, due to having been cleared by with the notice of foreground resident service process binding, thus user is difficult to aware system actually justIn operation foreground resident service process (i.e. resident service process in foreground also lives), so as to will not the resident clothes in the active killing foregroundBusiness process, corresponding backstage resident service process also will not be fallen by killing, that is, close foreground transient service process and remove correspondenceNotice, resident service will not be affected, can normally run on foreground, not only maintain resident service processThe high priority of front stage operation state, and because the notice bound therewith is closed for these reasons, now user is difficultAlso in front stage operation with discovering resident service, thus typically will not actively clear up this or these resident service, on the one hand, afterPlatform service processes are configured to priority after the service processes of foreground and improve, on the other hand, for pointing out the background service processThe notice run with foreground running status is also removed by transient service process, thus user will not discover and actively removeThe background service process, has reached the life-span i.e. technique effect of keep-alive background service process for extending background service process.
It should be noted that in embodiments of the present invention, it is right in the following manner can be configured to background service processThe foreground service processes configuration answered:It is configured to so that backstage transient service process is configured into corresponding foreground transient service processExample, during enforcement, can first state and start backstage transient service process, recall system API " startForegruond " to incite somebody to actionBackstage transient service process is set to foreground transient service process;It is normal so that backstage resident service process is configured into corresponding foregroundAs a example by configuration in service processes, during enforcement, can first start backstage resident service process, recall system API" startForegruond " by backstage resident service process being set to foreground resident service process.
In embodiments of the present invention, adopt and the two foreground service processes for obtaining are respectively configured by two background service processesThe mode being bundled in same notice, by obtaining foreground transient service process, wherein, foreground transient service process is by rearThe configuration of platform transient service process is obtained, and is bundled in a notice with foreground resident service process, and foreground resident service entersJourney is obtained by backstage resident service process configuration, is notified for pointing out foreground transient service process and foreground resident service to enterJust in front stage operation, the priority of foreground resident service process is higher than the priority of backstage resident service process to journey;Close foregroundTransient service process;The notice bound together with foreground transient service process is removed, with keep-alive background service process, due to closingClosing system after transient service process can remove the notice for binding together therewith from informing automatically, and notify to be cancelled itAfterwards, user is just difficult to discover the resident service process with high priority in front stage operation, and only further, user has been detectableResident service process be currently running would not active killing this (or these) process, thus reached sacrifice transient service processWith prevent user's active killing just with high priority the resident service process of front stage operation purpose, it is achieved thereby that keep-alive is justWith high priority the resident service process of front stage operation technique effect, and then solve in correlation technique by foreground service intoJourney be individually bundled in one notify on, cause remove the notice will necessarily cancel therewith with binding relationship foreground service intoJourney, and then cause the background service process corresponding with the foreground service processes will necessarily killed technical problem.
Alternatively, said apparatus also include:First processing units, for before foreground transient service process is obtained, openingDynamic backstage resident service process simultaneously configures foreground resident service process, and foreground is resided into clothes according to backstage resident service processBusiness process is bundled in notice;Second processing unit, for starting backstage transient service process and being entered according to backstage transient serviceJourney configures foreground transient service process, and foreground transient service process is also bundled in notice.
Alternatively, said apparatus also include:Definition unit, before platform transient service process upon actuation, defines oneIndividual empty service processes;Statement unit, for stating that empty service processes are backstage transient service process.
Alternatively, above-mentioned first processing units are additionally operable to:Call front stage operation state to open function backstage is resided into clothesBusiness process configures foreground resident service process;Second processing unit is additionally operable to:Front stage operation state is called to open function with by afterPlatform transient service process configures foreground transient service process;First closing unit is additionally operable to:Front stage operation state is called to close letterNumber, to close foreground transient service process.
Alternatively, said apparatus also include:Second closing unit, is additionally operable to the same of platform transient service process before being turned offWhen, close backstage transient service process corresponding with foreground transient service process.
Alternatively, above-mentioned second closing unit includes:Calling module, for calling background service to close function;Operation mouldBlock, for running background service function is closed, to close backstage transient service process corresponding with foreground transient service process.
It should be noted that the embodiment of device part same or like, Shen corresponding with the embodiment of method partAsk someone will not be described here, while the function that the units/modules in each embodiment in device part are realized is each with method partThe function correspondence that corresponding step in embodiment is realized is same or like, and applicant will not be described here.
Embodiment 3
Embodiments of the invention can provide a kind of terminal, and the terminal can be in terminal groupAny one computer terminal.Alternatively, in the present embodiment, above computer terminal can also replace with mobile wholeThe terminal devices such as end.
Alternatively, in the present embodiment, above computer terminal may be located in multiple network equipments of computer networkAt least one network equipment.
In the present embodiment, above computer terminal can be performed in the keepalive method of background service process of application programThe program code of following steps:Foreground transient service process is obtained, wherein, foreground transient service process is by backstage transient serviceProcess configuration is obtained, and foreground transient service process is bundled in one and notifies that foreground is resided with foreground resident service processService processes are obtained by backstage resident service process configuration, are notified for pointing out foreground transient service process and foreground residentJust in front stage operation, the priority of foreground resident service process is higher than the priority of backstage resident service process to service processes;CloseClose foreground transient service process;The notice bound together with foreground transient service process is removed, with keep-alive background service process.
Alternatively, above computer terminal (being labeled as terminal A) can include:One or more (only show in figureGo out one) processor, memory and miscellaneous part.
Wherein, memory can be used to store software program and module, the background service process such as in the embodiment of the present inventionKeepalive method and the corresponding programmed instruction/module of device, processor by operation be stored in software program in memory withAnd module, so as to perform various function application and data processing, that is, realize the keepalive method of above-mentioned background service process.DepositReservoir may include high speed random access memory, can also include nonvolatile memory, such as one or more magnetic storage device,Flash memory or other non-volatile solid state memories.In some instances, memory can further include remote relative to processorThe memory that journey is arranged, these remote memories can be by network connection to terminal A.The example of above-mentioned network includes but does not limitIn internet, intranet, LAN, mobile radio communication and combinations thereof.
Processor can call the information and application program of memory storage by transmitting device, to perform following step:After foreground transient service process corresponding with backstage transient service process is cancelled, backstage transient service process is closed.
Optionally, above-mentioned processor can also carry out the program code of following steps:Obtaining foreground transient service processBefore, backstage resident service process is started and according to backstage resident service process configuration foreground resident service process, and will be frontPlatform resident service process is bundled in notice;Start backstage transient service process and according to backstage transient service process configuration foregroundTransient service process, and foreground transient service process is also bundled in notice.
Optionally, above-mentioned processor can also carry out the program code of following steps:Platform transient service process upon actuationBefore, method also includes:Define an empty service processes;The empty service processes of statement are backstage transient service process.
Optionally, above-mentioned processor can also carry out the program code of following steps:Front stage operation state is called to open letterCount for backstage resident service process to configure foreground resident service process;Front stage operation state is called to open function so that backstage to be facedWhen service processes configuration foreground transient service process;Call front stage operation state to close function, entered with closing foreground transient serviceJourney.
Optionally, above-mentioned processor can also carry out the program code of following steps:Platform transient service process before being turned offWhile, close backstage transient service process corresponding with foreground transient service process.
Optionally, above-mentioned processor can also carry out the program code of following steps:Background service is called to close function;FortuneRow background service closes function, to close backstage transient service process corresponding with foreground transient service process.
In embodiments of the present invention, bound by the way of same notice, before acquisition using two foreground service processesPlatform transient service process, wherein, foreground transient service process is obtained by backstage transient service process configuration, and normal with foregroundOne is bundled in service processes to notify, foreground resident service process is obtained by backstage resident service process configuration, is led toKnow for pointing out foreground transient service process and foreground resident service process just in front stage operation, foreground resident service process it is excellentPriority of the first level higher than backstage resident service process;Close foreground transient service process;Remove and foreground transient service processThe notice for binding together, with keep-alive background service process, has been reached and the purpose for notifying has been removed using transient service process, so as toRealizing prevents user to dislike, it is to avoid the technique effect that Resident Process is killed, and then solves in correlation technique and service on foregroundProcess be individually bundled in one notify on, cause remove the notice will necessarily cancel therewith with binding relationship foreground service intoJourney, and then cause the background service process corresponding with the foreground service processes will necessarily killed technical problem.
It will appreciated by the skilled person that the structure shown in Fig. 1 is only illustrated, terminal can also be intelligenceCan mobile phone (such as Android phone, iOS mobile phones), panel computer, applause computer and mobile internet device (MobileInternet Devices, MID), the terminal device such as PAD.Fig. 1 it does not cause to limit to the structure of above-mentioned electronic installation.ExampleSuch as, terminal 10 may also include more more than shown in Fig. 1 or less components (such as network interface, display device),Or with the configuration different from shown in Fig. 1.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is canTo be completed come the device-dependent hardware of command terminal by program, the program can be stored in a computer-readable recording mediumIn, storage medium can include:Flash disk, read-only storage (Read-Only Memory, ROM), random access device (RandomAccess Memory, RAM), disk or CD etc..
Embodiment 4
Embodiments of the invention additionally provide a kind of storage medium.Alternatively, in the present embodiment, above-mentioned storage medium canProgram code performed by the keepalive method of the background service process provided for preservation above-described embodiment 1.
Alternatively, in the present embodiment, above-mentioned storage medium may be located in computer network Computer terminal groupIn any one terminal, or in any one mobile terminal in mobile terminal group.
Alternatively, in the present embodiment, storage medium is arranged to store the program code for performing following steps:ObtainForeground transient service process is taken, wherein, foreground transient service process is obtained by backstage transient service process configuration, and foregroundTransient service process is bundled in one and notifies with foreground resident service process, and foreground resident service process is by the resident clothes in backstageThe configuration of business process is obtained, and is notified for pointing out foreground transient service process and foreground resident service process just in front stage operation,Priority of the priority of foreground resident service process higher than backstage resident service process;Close foreground transient service process;ClearlyExcept the notice bound together with foreground transient service process, with keep-alive background service process.
Alternatively, in the present embodiment, storage medium is also configured to store the program code for performing following steps:Before foreground transient service process is obtained, start backstage resident service process and according to backstage resident service process configuration foregroundResident service process, and foreground resident service process is bundled in notice;Start backstage transient service process and according to afterPlatform transient service process configures foreground transient service process, and foreground transient service process is also bundled in notice.
Alternatively, in the present embodiment, storage medium is arranged to store the program code for performing following steps:Before starting backstage transient service process, method also includes:Define an empty service processes;The empty service processes of statement face for backstageWhen service processes.
Alternatively, in the present embodiment, storage medium is arranged to store the program code for performing following steps:AdjustOpen function backstage resident service process is configured into foreground resident service process with front stage operation state;Call front stage operation shapeState opens function backstage transient service process is configured into foreground transient service process;Front stage operation state is called to close function,To close foreground transient service process.
Alternatively, in the present embodiment, storage medium is arranged to store the program code for performing following steps:While closing foreground transient service process, backstage transient service process corresponding with foreground transient service process is closed.
Alternatively, in the present embodiment, storage medium is arranged to store the program code for performing following steps:AdjustFunction is closed with background service;Operation background service closes function, is faced with closing backstage corresponding with foreground transient service processWhen service processes.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
In the above embodiment of the present invention, the description to each embodiment all emphasizes particularly on different fields, and does not have in certain embodimentThe part of detailed description, may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents, can pass through otherMode is realized.Wherein, device embodiment described above is only schematic, such as the division of described unit is onlyA kind of division of logic function, can there is an other dividing mode when actually realizing, such as multiple units or component can with reference to orPerson is desirably integrated into another system, or some features can be ignored, or does not perform.Another, shown or discussed is mutualBetween coupling or direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some interfaces, unit or moduleConnect, can be electrical or other forms.
The unit as separating component explanation can be or may not be it is physically separate, it is aobvious as unitThe part for showing can be or may not be physical location, you can with positioned at a place, or can also be distributed to multipleOn NE.Some or all of unit therein can according to the actual needs be selected to realize the mesh of this embodiment scheme's.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible toIt is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated listUnit both can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is realized using in the form of SFU software functional unit and as independent production marketing or usedWhen, during a computer read/write memory medium can be stored in.Based on such understanding, technical scheme is substantiallyThe part for contributing to prior art in other words or all or part of the technical scheme can be in the form of software productsEmbody, the computer software product is stored in a storage medium, including some instructions are used so that a computerEquipment (can be personal computer, server or network equipment etc.) perform the whole of each embodiment methods described of the invention orPart steps.And aforesaid storage medium includes:USB flash disk, read-only storage (ROM, Read-Only Memory), arbitrary access are depositedReservoir (RAM, Random Access Memory), portable hard drive, magnetic disc or CD etc. are various can be with store program codesMedium.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the artFor member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also shouldIt is considered as protection scope of the present invention.