CN107025118B - Method and device for ending application program - Google Patents

Method and device for ending application program Download PDF

Info

Publication number
CN107025118B
CN107025118B CN201610074686.8A CN201610074686A CN107025118B CN 107025118 B CN107025118 B CN 107025118B CN 201610074686 A CN201610074686 A CN 201610074686A CN 107025118 B CN107025118 B CN 107025118B
Authority
CN
China
Prior art keywords
application program
application
program
task
closing time
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.)
Active
Application number
CN201610074686.8A
Other languages
Chinese (zh)
Other versions
CN107025118A (en
Inventor
陈猛
胡晶晶
刘慧�
张枫枫
杨启波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610074686.8A priority Critical patent/CN107025118B/en
Publication of CN107025118A publication Critical patent/CN107025118A/en
Application granted granted Critical
Publication of CN107025118B publication Critical patent/CN107025118B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method for ending an application program, belonging to the field of computers and communication. The method comprises the following steps: when detecting that a first application program is switched from a foreground to a background of a terminal, determining system resources needing to be called when the first application program executes a task; judging whether the first application program is executing a task or not according to system resources required to be called when the first application program executes the task; and if the current first application program is judged not to execute the task, ending the continuous running of the first application program in the background of the terminal. The problem of untight application program ending is solved, and the effect of improving the accuracy of application program ending is achieved.

Description

Method and device for ending application program
Technical Field
The present invention relates to the field of computer and communication technologies, and in particular, to a method and an apparatus for terminating an application.
Background
With the continuous development of the intelligent terminal technology, more and more application programs can be installed on the intelligent terminal, but in the process of using the application programs, even if a user quits the current application program, if the user does not enter the setting to kill the application program, the application program can still continue to run in the background, so that the application program is often closed untimely, some application programs which do not execute any operation are also run in the intelligent terminal, and the problems of shortening the endurance time of the intelligent terminal and wasting system resources of the intelligent terminal are caused.
In order to solve the above problems, the following methods are currently introduced: after the intelligent terminal is locked, each application program running in the background of the intelligent terminal is obtained, the application programs included in the blacklist are obtained from the application programs, and then the application programs included in the blacklist are ended. The blacklist is set by a user in advance, and the application program to be ended after the screen of the intelligent terminal is locked is recorded in the blacklist.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
the ending operation is performed according to the blacklist, and there are applications which can end the task being executed in the blacklist, and the ending of the applications is not strict enough.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for ending an application. The technical scheme is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a method of ending an application, the method comprising:
when detecting that a first application program is switched from a foreground to a background of a terminal, determining system resources needing to be called when the first application program executes a task;
judging whether the first application program is executing a task or not according to system resources required to be called when the first application program executes the task;
and if the current first application program is judged not to execute the task, ending the continuous running of the first application program in the background of the terminal.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for ending an application, the apparatus comprising:
the system comprises a determining module, a processing module and a processing module, wherein the determining module is used for determining system resources which need to be called when a first application program executes a task when the first application program is detected to be switched from a foreground to a background of a terminal;
the judging module is used for judging whether the first application program is currently executing the task according to the system resource which is determined by the determining module and needs to be called when the first application program is executing the task;
and the ending module is used for ending the continuous running of the first application program in the background of the terminal if the judging module judges that the first application program does not execute the task currently.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the method for ending the application program can be executed after the application program in the terminal enters the background, namely the method for ending the application program can be executed at any time when the user uses the terminal, so that the problem that the application program which does not execute any task cannot be ended in time when the terminal is used is solved, and the effect of improving the timeliness of the application program is ended is achieved; and the method for ending the application program is ended when the application program does not execute any task, so that the problem of untight ending of the application program is solved, and the effect of accuracy of ending the application program is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a network architecture diagram of an application of the present disclosure;
FIG. 2 is a flow diagram of a method for ending an application according to one embodiment of the present invention;
FIG. 3A is a flowchart of a method for ending an application according to yet another embodiment of the present invention;
FIG. 3B is a flowchart of a method for determining APIs to call when a first application performs a task according to another embodiment of the invention;
FIG. 3C is a flowchart of a method for detecting whether an interactive user interface UI is currently provided by a first application, according to yet another embodiment of the invention;
FIG. 4A is a block diagram of an apparatus for ending an application according to an embodiment of the present invention;
FIG. 4B is a block diagram of an apparatus for determining a system resource that needs to be called by the first application when performing a task according to another embodiment of the present invention;
FIG. 4C is a block diagram of an apparatus for determining a system resource that needs to be invoked by the first application when performing a task according to another embodiment of the present invention;
FIG. 4D is a schematic structural diagram of an apparatus for determining whether the first application is currently executing a task according to another embodiment of the present invention;
FIG. 4E is a block diagram illustrating an apparatus for ending an application according to an embodiment of the present invention;
FIG. 4F is a block diagram illustrating an apparatus for determining a system resource that needs to be called by a first application when executing a task according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device for ending an application according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings. The "electronic device" referred to herein may include a smart phone, a tablet computer, a smart television, an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III, mpeg Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, mpeg Audio Layer 4), a laptop computer, a desktop computer, and the like.
Fig. 1 is a diagram of a network architecture to which embodiments of the present invention are applied, and referring to fig. 1, the network architecture may include, but is not limited to, at least one server 120 and a terminal 140.
The server 120 is configured to count and store a corresponding relationship between an application program and an application type, and a corresponding relationship between the application program and a first closing time, which is specifically described in the following embodiments.
The terminal 140 may install and run an application, and the terminal 140 may install a system, may provide a system resource for the application, and the application may perform a task by calling the system resource. The system resource may be an application programming interface, API.
The terminal 140 can store and save data and download data resources from the server 120 through a wired or wireless network. For example, the correspondence between the application type and the function may be stored.
The server 120 and the terminal 140 can be connected through a wired or wireless network.
Fig. 2 is a flowchart of a method for ending an application according to an embodiment of the present invention, and referring to fig. 2, the method includes, but is not limited to:
in step 201, when it is detected that the first application program is switched from the foreground to the background of the terminal, the system resource that the first application program needs to call when executing the task is determined.
In step 202, it is determined whether the first application is currently executing a task according to system resources that the first application needs to call when executing the task.
In step 203, if it is determined that the first application program does not execute the task currently, ending the continuous running of the first application program in the background of the terminal.
In summary, in the method for ending an application program provided in this embodiment, when an application program in a terminal is switched from a foreground to a background, a system resource that the application program needs to call when executing a task is obtained, whether the application program is executing the task is determined according to the system resource that the application program needs to call when executing the task, and if the application program is not executing any task, the application program is ended; the method for ending the application program can be executed after the application program in the terminal enters the background, namely the method for ending the application program can be executed at any time when the user uses the terminal, so that the problem that the application program which does not execute any task cannot be ended in time when the terminal is used is solved, and the effect of improving the timeliness of the application program is ended is achieved; and the method for ending the application program is ended when the application program does not execute any task, so that the problem of untight ending of the application program is solved, and the effect of accuracy of ending the application program is improved.
Fig. 3A is a flowchart of a method for ending an application according to yet another embodiment of the present invention, where when an application in a terminal is switched from a foreground to a background, the method determines a system resource that needs to be called when the application executes a task, determines whether the application is executing the task according to the system resource that needs to be called when the application executes the task, and ends the application if the application does not execute any task. The system resource may be an API in this embodiment. Referring to fig. 3A, the method includes, but is not limited to:
in step 301, the running state of the first application program in the terminal is detected in real time.
The first application program refers to application programs running in a foreground and a background in the terminal.
The running states may include foreground running and background running.
Optionally, in this embodiment, the running state of the first application program may be determined by detecting the interface state of the first application program. Specifically, when at least one interface in the interfaces of the first application program runs in a foreground, determining that the running state of the first application program is a foreground running state; and when detecting that all the interfaces of the first application program run in the background, determining that the running state of the first application program is a background running state.
Alternatively, the interface may be an Activity, icon, or other interface.
Optionally, in this embodiment, an injection technique may be used to detect an operating state of the interface of the first application program in the terminal. For example, when the interface is Activity, the specific process may include, but is not limited to, detecting the running state of the Activity by the following methods: writing an Activity state monitoring code, injecting the Activity state monitoring code into a system service process, wherein the system service process can manage the running states of all Activities in a terminal, so that the monitoring code is run when the system service process is run, and the terminal is informed when the Activity at the top of the Activity stack changes. For example, if the Activity of the current stack top is the Activity of the first application program, when the monitored Activity of the stack top changes, the terminal is notified that the Activity of the first application program is popped from the stack top, and then the Activity state of the current stack top is continuously monitored.
The state change of the Activity stack top is monitored through an injection technology, a callback can be obtained when the Activity state changes, the Activity of the current stack top is not required to be obtained through circularly traversing the Activity stack top, and the system resource occupation is greatly reduced.
For detecting the running state of the first application program in the terminal in real time, the above detection method is only used as an example, and the detection method in this embodiment is limited to this method.
In step 302, when it is detected that the first application program is switched from the foreground to the background of the terminal, the program identifier of the first application program is enqueued from the tail of the cache queue.
The buffer queue is a first-in first-out buffer queue and is used for storing program identifiers of application programs which are switched from a terminal foreground to a background and are smaller than or equal to a preset threshold value, and the specific steps are as follows: when detecting that the application program is switched from the foreground to the background of the terminal, enqueuing the program identification corresponding to the application program from the tail of the cache queue and storing the program identification in the cache queue; and when the quantity of the program identifications stored in the cache queue is greater than a preset threshold value, dequeuing the program identifications stored at the head of the cache queue until the quantity of the program identifications included in the cache queue does not exceed a preset value. Therefore, the first-in first-out buffer queue can be used for preferentially processing the program identifier which enters the buffer queue firstly when the number of the program identifiers stored in the buffer queue is larger than a preset threshold value.
Further, after the program identifier of the first application program is queued from the tail of the cache queue, when it is detected that the first application program is switched from the background to the foreground of the terminal, if the application identifier of the first application program is in the cache queue, the program identifier of the first application program is deleted from the cache queue. When the first application program is switched from the background to the foreground of the terminal, the application program needs to execute a task, so that the program identifier is deleted from the cache queue, the subsequent related judgment whether to finish the operation of the application program is not carried out, and the program identifier is deleted from the cache queue, so that the method not only accords with the actual situation, but also reduces the subsequent related judgment and improves the utilization rate of system resources.
In step 303, after the program identifier of the first application program is enqueued, if the number of application identifiers included in the cache queue exceeds a preset value, the program identifiers included in the cache queue are dequeued from the head of the cache queue until the number of program identifiers included in the cache queue does not exceed the preset value.
The method comprises the following steps: and after the first application program is enqueued, acquiring the quantity of the program identifiers included in the cache queue, comparing the quantity of the program identifiers with a preset numerical value, and if the quantity of the program identifiers is larger than the preset numerical value, dequeuing the program identifiers in the cache queue from the head of the cache queue until the quantity of the program identifiers included in the cache queue does not exceed the preset numerical value.
For example, the preset value is 3, and after the first application program is enqueued, the number of the obtained program identifiers currently included in the cache queue is 4, so that the number of the program identifiers included in the cache queue is greater than the preset value, and therefore 1 program identifier is dequeued from the head of the cache queue, so that the number of the program identifiers included in the cache queue is 3.
By using the first-in first-out buffer queue, the program identifiers which firstly enter the buffer queue can be preferentially processed, and the number of the program identifiers included in the buffer queue can be always smaller than or equal to a preset threshold value. Because the application program corresponding to the program identifier of the preset threshold value which is queued recently is the application program which is switched from the foreground to the background from the current recent time, the application program of the preset threshold value is likely to be frequently switched to the foreground for use, and therefore, the subsequent relevant judgment on whether to finish the operation of the application program is not performed on the application program which is switched from the foreground to the background recently, which not only accords with the actual situation, but also reduces the subsequent relevant judgment and improves the utilization rate of system resources.
In step 304, when the application identifier of the first application program is dequeued from the head of the cache queue, a first closing time corresponding to the first application program is determined, and a correspondence between the program identifier of the first application program and the first closing time is stored in a waiting list.
The first closing time is after the current time, specifically, after the application identifier of the first application program is dequeued from the head of the cache queue until it is needed to start determining whether to end the first application program, which is specifically described in the following step for determining whether to end the first application program.
Optionally, the first closing time may be obtained by: for each application program, the server counts the average time length between the background running of a large number of users from the application program to the closing of the application program, determines the average time length as the first waiting time length of the application program, and stores the program identification of the application program and the first waiting time length in a corresponding relation table of the program identification and the first closing time. The terminal obtains a corresponding relation table of the program identifier and the first waiting time from the server and stores the corresponding relation table in the local, when first closing time corresponding to the first application program needs to be determined, the program identifier of the first application program is obtained firstly, the obtained first program identifier is compared with the program identifiers in the corresponding relation table, the program identifier which is the same as the obtained first program identifier is inquired, the first waiting time corresponding to the inquired program identifier is obtained from the corresponding relation table, and the first waiting time and the current time are added to obtain the first closing time of the first application program.
The waiting list stores the program identifier dequeued from the buffer queue, and the first closing time corresponding to the program identifier is not reached yet.
Optionally, the program identifiers are sorted in the wait list according to the sequence of the first closing time corresponding to each program identifier.
It should be noted that, after storing the corresponding relationship between the program identifier of the first application program and the first closing time in the waiting list, if it is detected that the first application program is switched from the background to the foreground of the terminal, if the application identifier of the first application program is located in the waiting list, the program identifier of the first application program and the first closing time are deleted from the waiting list. When the first application program is switched from the background to the foreground of the terminal, the application program needs to execute a task, so that the subsequent related judgment whether to finish the operation of the application program is stopped, and the program identifier is deleted from the waiting list, so that the method not only accords with the actual situation, but also reduces the subsequent related judgment and improves the utilization rate of system resources.
In step 305, the closing time stored in the wait list is detected in real time, and if it is detected that the first closing time arrives, the program identifier of the first application corresponding to the first closing time is obtained from the wait list.
The method comprises the following steps: after the corresponding relation between the program identifier of the first application program and the first closing time is stored in a waiting list, detecting each first closing time in real time, and when the first closing time is detected to be reached, acquiring the program identifier of the first application program corresponding to the first closing time from the waiting list.
In step 306, according to the program identifier of the first application program, APIs called when the first application program executes a task are determined.
Optionally, referring to fig. 3B, the APIs called by the first application when executing the task may be determined by the following methods, as shown in fig. 3B, which include but are not limited to:
in step 3061, the application type of the first application program is obtained from the correspondence between the program identifier and the application type according to the program identifier of the first application program.
The correspondence between the program identifier and the application type may be obtained by: the corresponding relation between the program identification and the application type is obtained by server statistics, the server sets the application type for each application program according to the function of each application program, for example, a QQ chat tool is set as a social type, QQ music is set as a play type, and the like, and the corresponding relation between the program identification of the application program and the application type is stored in a first corresponding relation table; the terminal acquires the first corresponding relation table from the server and stores the first corresponding relation table in the local so as to timely acquire the first corresponding relation table from the local when needed.
The method comprises the following steps: when the program identifier of the first application program is acquired, comparing the program identifier of the first application program with each program identifier in the first corresponding relation table, acquiring the program identifier which is the same as the program identifier of the first application program, inquiring an application type corresponding to the acquired program identifier from the first corresponding relation table, and determining the inquired application type as the application type corresponding to the first application program.
In step 3062, the functions included in the first application are determined from the correspondence between application type and function, based on the application type.
The corresponding relationship between the application type and the function is stored in a second corresponding relationship table, which can be obtained by, but not limited to, the following methods: obtaining a first application program included in a first type application program, analyzing the function of the first application program, recording and analyzing the function of the first application program, then acquiring a second application program included in the first type application program, analyzing the function of the second application program, recording and analyzing to obtain the function of the second application program, then, a third application program included in the first type application program is obtained, the function of the third application program is analyzed, the function of the third application program is obtained through recording and analyzing until all the application programs included in the first type application program are analyzed, and taking a union set of the functions of each application program obtained by analysis, taking all the functions in the union set as the first functions of the first type application programs, and storing the corresponding relation between the first type application programs and the first functions in the second corresponding relation table. According to the method, the corresponding relation between the second type application program and the second function is stored in the second corresponding relation table, and the corresponding relation between the third type application program and the third function is stored in the second corresponding relation table until the corresponding relation between all the types of application programs and the functions is stored.
The method comprises the following steps: comparing the application type obtained in step 3062 with each application type in the second correspondence table, determining the application type identical to the application type obtained in step 3062 from the second correspondence table, querying the function corresponding to the obtained application type from the second correspondence table, and determining each function included in the first application program according to the queried function.
In step 3063, according to the functions included in the first application, the APIs to be called by the first application for executing the functions are obtained from the correspondence between the functions and the APIs.
Each time the application program executes a function, it needs to call an API, and the correspondence between the function and the API is stored in the third correspondence table.
Obtaining a first function of the first application program, comparing the first function with each function in the third corresponding relation to obtain a function which is the same as the first function, and determining an API corresponding to the function as an API to be called by the first application program for executing the first function; obtaining a second function of the first application program, comparing the second function with each function in the third corresponding relation to obtain a function which is the same as the second function, and determining an API corresponding to the function as an API to be called by the first application program for executing the second function; and obtaining a third function of the first application program, comparing the third function with each function in the third corresponding relation to obtain a function which is the same as the third function, and determining the API corresponding to the function as the API to be called by the first application program for executing the third function until obtaining the APIs corresponding to all the functions of the first application program.
In step 307, it is determined whether the first application is currently executing a task according to the APIs.
The method comprises the following steps: judging whether the current first application program calls or runs one or more of the determined APIs, and when the current first application program is judged to call or run one or more of the APIs, determining that the current first application program is executing a task; and when judging that the first application program does not call or run any API, determining that the first application program does not execute the task.
If the first application program is judged to be executing the task currently, executing step 308; if the first application program is judged not to execute any task currently, the operation of step 310 is executed.
In step 308, if it is determined that the first application is currently executing a task, a second closing time of the first application is determined.
If the first application program is judged to be executing the task currently, because the first application program is executing the task, the first application program cannot be ended, the closing time needs to be reset for the first application program to wait for judging whether the first application program is ended again, and the reset closing time is the second closing time.
The second off-time is after the first off-time, and the second off-time can be obtained by: and setting a second waiting time length for the first application program, and adding the second waiting time length and the first closing time to obtain a second closing time. The second waiting time may be set to any value, but in general, the second waiting time is smaller than the first waiting time, and the second waiting time may be set to 3 minutes or 4 minutes empirically, without limitation.
After the second closing time is determined for the first application program, the application program identifier corresponding to the first application program is stored in the waiting list again to wait for the second closing time to arrive.
In step 309, when the second closing time is reached, determining whether the first application is currently executing according to the APIs is performed.
The method comprises the following steps: when the second closing time is reached, the operation of step 307 is executed again to determine whether the first application is currently executing a task, and when it is determined that the first application is currently executing a task, the second closing time is determined again for the first application. The above process is repeated until it is determined that the first application program does not execute the task, and the operation of step 310 is executed.
In step 310, if it is determined that the first application is not currently executing a task, it is detected whether the first application currently provides an interactive UI.
Optionally, referring to fig. 3C, it may be detected whether the first application currently provides an interactive UI by the following methods, as shown in fig. 3C, the detection methods include but are not limited to:
in step 3101, it is determined whether the first application is running in the foreground.
The running state of the first application program can be foreground running, background running and closing. When the running state of the first application program is foreground running, the first application program is indicated to be executing a task, at the moment, the first application program can provide an interactive UI for interacting with a user, and the first application program is determined to be currently provided with the interactive UI.
Optionally, it may be determined whether the first application is in foreground operation by the following method: and acquiring the Activity of the stack top in the Activity stack of the system, and judging whether the first application program runs in the foreground according to the Activity of the stack top. Managing all Activities in the application program in an Activity stack, acquiring the Activity at the top of the Activity stack, and if the Activity is the Activity running in the first application program, determining that the first application program runs in the foreground. Indicating that the application is executing a task, the application is not finished.
Wherein, Activity has the same meaning as the above Activity, and is not described herein.
If it is determined in this step that the first application is currently in the foreground, step 311 is executed, and if it is determined that the first application is not currently in the foreground, step 3102 is executed.
At step 3102, a determination is made as to whether the program identifier of the first application is within the notification bar list.
The terminal notification bar list stores the application program of the part running in the background in the terminal, the application program may be executing the task, and the user can operate the application program through the UI interface displayed in the notification bar to complete the user interaction. So when it is detected that the program identification of the first application is included in the notification bar list, it indicates that the first application is executing a task or is likely to start executing a task in a short time. The application is not ended.
If it is determined in this step that the program id of the first application is in the notification bar list, step 311 is performed, and if it is determined that the program id of the first application is not in the notification bar list, step 3103 is performed.
At step 3103, it is determined whether the program identification of the first application is within a preset priority level of the process priority list.
The process priority list stores the priority of the process in the terminal, and the process priority can be dynamically adjusted according to the running state of the process in the terminal. Generally, the process priority levels are sequentially lowered in the following order: foreground running process, visual process, secondary service process, background process, content supply node process and null process. The process running in the foreground is the process executing the task, and the visual process is the process which is likely to start executing the task in a short time.
Therefore, by acquiring the content of the process priority list, if at least one process in the first application is a foreground process or a visual process, the first application is considered to currently provide an interactive UI, and the first application is not ended.
The meaning of the foreground process, the visual process, the secondary service process, the background process, the content providing node process and the null process are all the prior art and are not described herein.
If it is determined in this step that the program identifier of the first application is in the level of the process priority list, step 311 is executed, and if it is determined that the program identifier of the first application is not in the level of the process priority list, step 312 is executed.
In step 311, detecting that the first application currently provides an interactive UI, a second closing time of the application is determined.
If it is detected in step 310 that the first application currently provides an interactive UI, it indicates that the first application is executing a task or starts executing a task within a short time, so that the first application cannot be ended, and a close time needs to be reset for the first application to wait to determine whether to end the first application again, where the reset close time is the second close time.
The second closing time is after the first closing time, and the second closing time can be set to any value, and can be set to 3 minutes or 4 minutes according to experience in general, and is not limited herein.
After the second closing time is determined for the first application program, the application program identifier corresponding to the first application program is stored in the waiting list again, and the first program identifier is timed again to wait for the second closing time to arrive. When the second off time is reached, the operation of step 309 is performed.
In step 312, if it is detected that the first application program does not currently provide an interactive UI, ending the continuation of the first application program in the background of the terminal.
Ending the first application means closing the first application, logging off the broadcast and alarm clock registered in the system, and prohibiting the application from self-starting.
Since the step 310 of detecting whether the first application program currently provides an interactive UI is performed only when it is determined in the step 307 that the first application program does not currently perform any task, when it is detected in the step 310 that the first application program currently provides an interactive UI, it indicates that the first application program is not performing a task and will not start performing a task in a short time, so that the first application program is finished to continue to run in the background of the terminal.
It should be noted that the above method for determining whether to end the first application program may be performed at any time when the user uses the terminal; if the terminal is locked, the terminal can be ended by the following method: after the terminal locks the screen, timing is started, and when the screen locking time of the terminal reaches the preset screen locking time, the program identifiers in the cache queue are dequeued one by one, and then the operation of the step 304 is executed.
Optionally, the embodiment can be applied to a mobile phone with an android system, because the application program running in the mobile phone does not end the application program after the running state of the application program enters the background from the foreground, and only when the memory of the mobile phone is insufficient, the application program running in the background can be ended, so that the application program which does not execute tasks can run in the background of the mobile phone, and the application program can occupy system resources and consume mobile phone energy; therefore, the method provided by the embodiment is used for finishing the application program which does not execute the task in the background, so that the system resource occupation is reduced, and the energy consumption of the mobile phone is reduced.
In summary, in the method for ending an application program provided in this embodiment, when an application program in a terminal is switched from a foreground to a background, a system resource that the application program needs to call when executing a task is obtained, whether the application program is executing the task is determined according to the system resource that the application program needs to call when executing the task, and if the application program is not executing any task, the application program is ended; the method for ending the application program can be executed after the application program in the terminal enters the background, namely the method for ending the application program can be executed at any time when the user uses the terminal, so that the problem that the application program which does not execute any task cannot be ended in time when the terminal is used is solved, and the effect of improving the timeliness of the application program is ended is achieved; and the method for ending the application program is ended when the application program does not execute any task, so that the problem of untight ending of the application program is solved, and the effect of accuracy of ending the application program is improved.
The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention. For details which are not disclosed in the embodiments of the apparatus of the present invention, reference is made to the embodiments of the method of the present invention.
Fig. 4A is a block diagram of an apparatus for ending an application according to an embodiment of the present invention, referring to fig. 4A, including but not limited to: a determination module 401, a determination module 402 and an end module 403.
The determining module 401 is configured to determine, when it is detected that the first application program switches from a foreground to a background of the terminal, a system resource that needs to be called when the first application program executes a task.
A determining module 402, configured to determine whether the first application is currently executing a task according to the system resource that needs to be called when the first application is executing the task, which is determined by the determining module 401.
An ending module 403, configured to end the continuous running of the first application program in the background of the terminal if the determining module 402 determines that the first application program does not execute the task currently.
Optionally, referring to fig. 4B, the determining module 401 includes: a first determination submodule 4011 and a second determination submodule 4012.
The first determining sub-module 4011 is configured to determine, when it is detected that the first application program switches from a foreground to a background of the terminal, a first closing time corresponding to the first application program, where the first closing time is after a current time.
The second determining submodule 4012 is configured to determine, when the first closing time determined by the first determining submodule 4011 is reached, a system resource that needs to be called when the first application executes a task.
Optionally, the system resource includes an application programming interface API, and referring to fig. 4C, the determining module 401 further includes: a first obtaining sub-module 4013, a third determining sub-module 4014, and a second obtaining sub-module 4015.
The first obtaining sub-module 4013 is configured to obtain, according to the program identifier of the first application program, the application type of the first application program from the correspondence between the program identifier and the application type.
A third determining submodule 4014, configured to determine, according to the application type obtained by the first obtaining submodule 4013, each function included in the first application program from a correspondence between the application type and the function.
A second obtaining sub-module 4015, configured to obtain, according to each function included in the first application program determined by the third determining sub-module 4014, each API that the first application program needs to call to execute each function from a corresponding relationship between the function and the API.
Optionally, the system resource includes an API, and referring to fig. 4D, the determining module 402 includes: a first judgment sub-module 4021 and a second judgment sub-module 4022.
The first determining submodule 4021 is configured to determine whether the first application calls or runs the API currently according to the API that the first application needs to call when executing the task, which is acquired by the second acquiring submodule 4015.
The second sub-determining module 4022 is configured to determine that the first application is currently executing a task if the first sub-determining module 4021 determines that the first application calls or runs the API.
Optionally, referring to fig. 4E, the apparatus further includes:
a detecting module 404, configured to detect whether the first application currently provides an interactive UI, and if not, execute the operation of ending the continuous running of the first application in the background of the terminal.
Optionally, still referring to fig. 4E, the apparatus further comprises:
a determining and judging module 405, configured to determine a second closing time of the first application program if the determining module 402 or the detecting and ending module 404 determines that the first application program is currently executing a task or detects that the first application program currently provides an interactive UI, where the second closing time is after the first closing time; and when the second closing time is up, executing the system resource which needs to be called when the first application program executes the task, and judging whether the first application program executes the task currently.
Optionally, still referring to fig. 4E, the apparatus further comprises: an enqueue module 406 and a dequeue module 407.
The enqueuing module 406 is configured to enqueue the program identifier of the first application from the tail of the cache queue when it is detected that the first application is switched from the foreground to the background of the terminal.
The dequeuing module 407 is configured to dequeue, after enqueuing, the program identifier included in the buffer queue from the head of the buffer queue until the number of the program identifiers included in the buffer queue does not exceed a preset value, if the number of the application identifiers included in the buffer queue exceeds the preset value.
The first determining submodule 4011 is further configured to determine a first closing time corresponding to the first application program when the application identifier of the first application program is dequeued from the head of the cache queue.
Optionally, still referring to fig. 4E, the apparatus further comprises:
the storing module 408 is configured to store the correspondence between the program identifier of the first application program and the first closing time in the waiting list when the application identifier of the first application program is dequeued from the head of the cache queue.
Referring to fig. 4F, the second determining sub-module 4012 includes: a detection acquisition unit 4012a, and a determination unit 4012 b.
The detection obtaining unit 4012a is configured to perform real-time detection on the closing time stored in the wait list, and if it is detected that the first closing time arrives, obtain, from the wait list, a procedure object of the first application corresponding to the first closing time.
The determining unit 4012b is configured to determine, according to the program identifier of the first application obtained by the detecting obtaining unit 4012a, a system resource called when the first application executes a task.
Optionally, still referring to fig. 4E, the apparatus further comprises:
a deleting module 409, configured to delete the program identifier of the first application program from the cache queue if it is detected that the first application program is switched from the background to the foreground of the terminal and the application identifier of the first application program is located in the cache queue; if the application identification of the first application program is on the waiting list, the program identification of the first application program and the first closing time are deleted from the waiting list.
Optionally, the embodiment can be applied to a mobile phone with an android system, because the application program running in the mobile phone does not end the application program after the running state of the application program enters the background from the foreground, and only when the memory of the mobile phone is insufficient, the application program running in the background can be ended, so that the application program which does not execute tasks can run in the background of the mobile phone, and the application program can occupy system resources and consume mobile phone energy; therefore, the device provided by the embodiment can be used for finishing the application program which does not execute the task in the background, so that the system resource occupation is reduced, and the energy consumption of the mobile phone is reduced.
In summary, in the apparatus for terminating an application program provided in this embodiment, when an application program in a terminal is switched from a foreground to a background, a system resource that the application program needs to call when executing a task is obtained, whether the application program is executing the task is determined according to the system resource that the application program needs to call when executing the task, and if the application program is not executing any task, the application program is terminated; the device for ending the application program can start to execute the task after the application program in the terminal enters the background, namely the device for ending the application program can be executed at any time when the user uses the terminal, so that the problem that the application program which does not execute any task cannot be ended in time when the terminal is used is solved, and the effect of improving the timeliness of the application program is achieved; and the device for finishing the application program finishes the application program when the application program does not execute any task, thereby solving the problem of untight finishing of the application program and improving the effect of finishing the accuracy of the application program.
It should be noted that: the apparatus and the terminal for terminating an application provided in the foregoing embodiments are only illustrated by the above-mentioned division of each functional module when providing a terminating application, and in practical applications, the above-mentioned function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the above-mentioned functions. In addition, the device box terminal for ending an application and the method embodiment of the method for ending an application provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
Referring to fig. 5, a schematic structural diagram of an electronic device for ending an application according to an embodiment of the present invention is shown. The electronic device is used for implementing the method for ending the application program provided in the above embodiment. Specifically, the method comprises the following steps:
electronic device 500 may include RF (Radio Frequency) circuitry 510, memory 520 including one or more computer-readable storage media, input unit 530, display unit 540, sensor 550, audio circuitry 560, WiFi (wireless fidelity) module 570, processor 580 including one or more processing cores, and power supply 590. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 5 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
RF circuit 510 may be used for receiving and transmitting signals during a message transmission or call, and in particular, for receiving downlink information from a base station and processing the received downlink information by one or more processors 580; in addition, data relating to uplink is transmitted to the base station. In general, RF circuitry 510 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, RF circuit 510 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 520 may be used to store software programs and modules, and the processor 580 executes various functional applications and data processing by operating the software programs and modules stored in the memory 520. The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the electronic device 500, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 520 may also include a memory controller to provide the processor 580 and the input unit 530 access to the memory 520.
The input unit 530 may be used to receive input numeric or character information and generate a keyboard, mouse, joystick, optical or trackball signal input related to user setting and function control. Specifically, the input unit 530 may include an image input device 531 and other input devices 532. The image input device 531 may be a camera or a photo scanning device. The input unit 530 may include other input devices 532 in addition to the image input device 531. In particular, other input devices 532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 540 may be used to display information input by or provided to the user and various graphical user interfaces of the electronic device 500, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 540 may include a Display panel 541, and optionally, the Display panel 541 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
The electronic device 500 may also include at least one sensor 550, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 541 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 541 and/or the backlight when the electronic device 500 is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the electronic device 500, detailed descriptions thereof are omitted.
The audio circuit 560, speaker 561, microphone 562 may provide an audio interface between a user and the electronic device 500. The audio circuit 560 may transmit the electrical signal converted from the received audio data to the speaker 561, and convert the electrical signal into a sound signal by the speaker 561 for output; on the other hand, the microphone 562 converts the collected sound signals into electrical signals, which are received by the audio circuit 560 and converted into audio data, which are then processed by the audio data output processor 580, either through the RF circuit 510 for transmission to another electronic device, for example, or output to the memory 520 for further processing. The audio circuitry 560 may also include an earbud jack to provide communication of a peripheral headset with the electronic device 500.
WiFi belongs to short-range wireless transmission technology, and the electronic device 500 can help the user send and receive e-mails, browse web pages, access streaming media, etc. through the WiFi module 570, which provides the user with wireless broadband internet access. Although fig. 5 shows the WiFi module 570, it is understood that it does not belong to the essential constitution of the electronic device 500, and may be omitted entirely within the scope not changing the essence of the invention as needed.
The processor 580 is a control center of the electronic device 500, connects various parts of the entire cellular phone using various interfaces and lines, and performs various functions of the electronic device 500 and processes data by operating or executing software programs and/or modules stored in the memory 520 and calling data stored in the memory 520, thereby performing overall monitoring of the cellular phone. Optionally, processor 580 may include one or more processing cores; preferably, the processor 580 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 580.
The electronic device 500 further includes a power supply 590 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 580 via a power management system that may be configured to manage charging, discharging, and power consumption. The power supply 590 may also include one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and any other components.
Although not shown, the electronic device 500 may further include a bluetooth module or the like, which is not described herein.
In particular, in this embodiment, the electronic device 500 also includes a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by one or more processors. The one or more programs include instructions for:
when detecting that a first application program is switched from a foreground to a background of a terminal, determining system resources needing to be called when the first application program executes a task;
judging whether the first application program is executing a task or not according to system resources required to be called when the first application program executes the task;
and if the current first application program is judged not to execute the task, ending the continuous running of the first application program in the background of the terminal.
Assuming that the above is the first possible implementation manner, in a second possible implementation manner provided on the basis of the first possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
when detecting that the first application program is switched from the foreground to the background of the terminal, determining the system resource which needs to be called when the first application program executes the task comprises the following steps:
when detecting that a first application program is switched from a foreground to a background of a terminal, determining first closing time corresponding to the first application program, wherein the first closing time is after the current time;
and when the first closing time is up, determining the system resource which needs to be called when the first application program executes the task.
In a third possible implementation manner provided as the basis for the first possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
the system resource comprises an API, and the step of determining the system resource which needs to be called when the first application program executes the task comprises the following steps:
acquiring the application type of the first application program from the corresponding relation between the program identification and the application type according to the program identification of the first application program;
determining each function included in the first application program from the corresponding relation between the application type and the function according to the application type;
and acquiring each API called by the first application program for executing each function from the corresponding relation between the function and the API according to each function included by the first application program.
In a fourth possible implementation manner provided as the basis of the first possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
the system resource includes an API, and the determining whether the first application program is currently executing a task according to the system resource that needs to be called when the first application program is executing a task includes:
judging whether the first application program calls or runs the API or not according to the API which needs to be called when the first application program executes the task;
and if the first application program calls or runs the API, judging that the first application program executes the task.
In a fifth possible implementation manner provided as the basis of the first possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
before the ending of the continuous running of the first application program in the background of the terminal, the method further includes:
and detecting whether the first application program provides an interactive UI currently or not, and if not, executing the operation of ending the continuous running of the first application program in the background of the terminal.
In a sixth possible implementation manner provided on the basis of the first or fifth possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
if the first application program is judged to be executing a task currently or the first application program is detected to provide an interactive UI currently, determining second closing time of the first application program, wherein the second closing time is after the first closing time; and when the second closing time is up, executing the system resource which needs to be called when the first application program executes the task, and judging whether the first application program executes the task currently.
In a seventh possible implementation manner provided as the basis of the second possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
before determining the first closing time corresponding to the first application program, the method further includes:
when detecting that a first application program is switched from a foreground to a background of a terminal, enqueuing a program identifier of the first application program from the tail of a cache queue;
after enqueuing, if the number of application identifiers included in the cache queue exceeds a preset numerical value, dequeuing the program identifiers included in the cache queue from the head of the cache queue until the number of the program identifiers included in the cache queue does not exceed the preset numerical value;
the determining the first closing time corresponding to the first application program includes:
and when the application identifier of the first application program is dequeued from the head of the cache queue, determining a first closing time corresponding to the first application program.
In an eighth possible implementation manner provided as the basis for the seventh possible implementation manner, the memory of the electronic device 500 further includes instructions for performing the following operations:
when the application identifier of the first application program is dequeued from the head of the cache queue, storing the corresponding relation between the program identifier of the first application program and the first closing time in a waiting list;
when the first closing time is up, determining system resources which need to be called when the first application program executes a task, including:
detecting closing time stored in the waiting list in real time, and if the first closing time is detected to be reached, acquiring a program identifier of the first application program corresponding to the first closing time from the waiting list;
and determining the system resource called when the first application program executes the task according to the program identifier of the first application program.
It should be understood that, as used herein, the singular forms "a," "an," "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (18)

1. A method of terminating an application, the method comprising:
injecting an Activity state monitoring code into a system service process, wherein the system service process is used for managing the running states of all Activities in a terminal, and the Activities are interfaces;
when the system service process is operated, the Activity state monitoring code is operated;
monitoring an Activity stack top by running the Activity state monitoring code, wherein the Activity stack top comprises the Activity of a first application program;
when the Activity at the top of the Activity stack is monitored to be changed, the running state change of the first application program is obtained;
when the operating state is detected to be changed to be that the first application program is switched from a foreground to a background of a terminal, determining an Application Programming Interface (API) which needs to be called when the first application program executes a task, wherein the API corresponds to a function, the API is an API corresponding to the function included in the first application program, and the API is used for executing the function;
judging whether the first application program calls or runs the API or not according to the API which needs to be called when the first application program executes the task;
when judging that the first application program is not called or the API is not operated, determining that the first application program does not execute the task currently;
and ending the continuous running of the first application program in the background of the terminal.
2. The method of claim 1, wherein determining an Application Programming Interface (API) that the first application needs to call when executing a task when detecting that the first application switches from a foreground to a background of the terminal comprises:
when detecting that a first application program is switched from a foreground to a background of a terminal, determining first closing time corresponding to the first application program, wherein the first closing time is after the current time;
and when the first closing time is up, determining the API which needs to be called when the first application program executes the task.
3. The method of claim 1, wherein determining an Application Programming Interface (API) that the first application needs to call when performing a task comprises:
acquiring the application type of the first application program from the corresponding relation between the program identification and the application type according to the program identification of the first application program;
determining each function included in the first application program from the corresponding relation between the application type and the function according to the application type;
and acquiring each API called by the first application program for executing each function from the corresponding relation between the function and the API according to each function included by the first application program.
4. The method of claim 1, wherein before the ending of the first application program continues to run in the background of the terminal, further comprising:
and detecting whether the first application program provides an interactive User Interface (UI) currently or not, and if not, executing the operation of ending the continuous running of the first application program in the background of the terminal.
5. The method of claim 2, further comprising:
if the first application program is judged to be executing a task currently or the first application program is detected to provide an interactive UI currently, determining second closing time of the first application program, wherein the second closing time is after the first closing time; and when the second closing time is up, executing the API which needs to be called when the first application program executes the task, and judging whether the first application program executes the task currently.
6. The method of claim 2, wherein determining the first closing time corresponding to the first application is preceded by:
when detecting that a first application program is switched from a foreground to a background of a terminal, enqueuing a program identifier of the first application program from the tail of a cache queue;
after enqueuing, if the number of application identifiers included in the cache queue exceeds a preset numerical value, dequeuing the program identifiers included in the cache queue from the head of the cache queue until the number of the program identifiers included in the cache queue does not exceed the preset numerical value;
the determining the first closing time corresponding to the first application program includes:
and when the application identifier of the first application program is dequeued from the head of the cache queue, determining a first closing time corresponding to the first application program.
7. The method of claim 6, further comprising:
when the application identifier of the first application program is dequeued from the head of the cache queue, storing the corresponding relation between the program identifier of the first application program and the first closing time in a waiting list;
when the first closing time is up, determining the API that needs to be called by the first application program when executing the task includes:
detecting closing time stored in the waiting list in real time, and if the first closing time is detected to be reached, acquiring a program identifier of the first application program corresponding to the first closing time from the waiting list;
and determining an API called when the first application program executes a task according to the program identifier of the first application program.
8. The method of claim 7, further comprising:
when the first application program is detected to be switched from the background to the foreground of the terminal, if the application identifier of the first application program is located in the cache queue, deleting the program identifier of the first application program from the cache queue; and if the application identifier of the first application program is positioned in the waiting list, deleting the program identifier of the first application program and the first closing time from the waiting list.
9. An apparatus for ending an application, the apparatus comprising:
the device is used for injecting an Activity state monitoring code into a system service process, wherein the system service process is used for managing the running states of all Activities in the terminal, and the Activities are interfaces; when the system service process is operated, the Activity state monitoring code is operated; monitoring an Activity stack top by running the Activity state monitoring code, wherein the Activity stack top comprises the Activity of a first application program; when the Activity at the top of the Activity stack is monitored to be changed, the running state change of the first application program is obtained;
a determining module, configured to determine, when it is detected that the operating state changes to that of the first application program from a foreground to a background of the terminal, an application programming interface API that needs to be called when the first application program executes a task, where the API corresponds to a function, and the API is an API corresponding to a function included in the first application program and is used to execute the function;
the judging module is used for judging whether the first application program calls or runs the API or not according to the API which needs to be called when the first application program executes the task; when judging that the first application program is not called or the API is not operated, determining that the first application program does not execute the task currently;
and the ending module is used for ending the continuous running of the first application program in the background of the terminal.
10. The apparatus of claim 9, wherein the determining module comprises:
the first determining submodule is used for determining first closing time corresponding to a first application program when the first application program is detected to be switched from a foreground to a background of a terminal, and the first closing time is behind the current time;
and the second determining submodule is used for determining the API which needs to be called when the first application program executes the task when the first closing time determined by the first determining submodule is reached.
11. The apparatus of claim 9, wherein the determining module further comprises:
the first obtaining submodule is used for obtaining the application type of the first application program from the corresponding relation between the program identification and the application type according to the program identification of the first application program;
a third determining submodule, configured to determine, according to the application type acquired by the first acquiring submodule, each function included in the first application program from a correspondence between an application type and a function;
and the second obtaining submodule is used for obtaining each API called by the first application program for executing each function from the corresponding relation between the function and the API according to each function included in the first application program determined by the third determining submodule.
12. The apparatus of claim 9, further comprising:
and the detection module is used for detecting whether the first application program provides an interactive User Interface (UI) at present, and if not, ending the continuous operation of the first application program in the background of the terminal.
13. The apparatus of claim 10, further comprising:
a determining and judging module, configured to determine a second closing time of the first application program if it is determined that the first application program is currently executing a task or it is detected that the first application program currently provides an interactive UI, where the second closing time is after the first closing time; and when the second closing time is up, judging whether the first application program is executing the task currently according to the API which needs to be called when the first application program is executing the task.
14. The apparatus of claim 10, further comprising:
the enqueuing module is used for enqueuing the program identifier of the first application program from the tail of the cache queue when the first application program is detected to be switched from the foreground to the background of the terminal;
the dequeuing module is used for dequeuing the program identifiers included in the cache queue from the head of the cache queue until the number of the program identifiers included in the cache queue does not exceed a preset value if the number of the application identifiers included in the cache queue exceeds the preset value after enqueuing;
the first determination submodule is further configured to: and when the application identifier of the first application program is dequeued from the head of the cache queue, determining a first closing time corresponding to the first application program.
15. The apparatus of claim 14, further comprising:
a storage module, configured to store, in a waiting list, a correspondence between the program identifier of the first application program and the first closing time when the application identifier of the first application program is dequeued from the head of the cache queue;
the second determination submodule includes:
the detection acquisition unit is used for detecting the closing time stored in the waiting list in real time, and acquiring the program identifier of the first application program corresponding to the first closing time from the waiting list if the first closing time is detected to be reached;
and the determining unit is used for determining the API called when the first application program executes the task according to the program identifier of the first application program acquired by the detection acquiring unit.
16. The apparatus of claim 15, further comprising:
a deleting module, configured to delete the program identifier of the first application program from the cache queue if it is detected that the first application program is switched from the background to the foreground of the terminal and the application identifier of the first application program is located in the cache queue; and if the application identifier of the first application program is positioned in the waiting list, deleting the program identifier of the first application program and the first closing time from the waiting list.
17. A computer-readable storage medium for storing a computer program which is loaded and executed by a processor to carry out the instructions of the method according to any one of claims 1 to 8.
18. An electronic device, comprising a processor and a memory, the memory being configured to store a computer program, the processor being configured to load and execute the computer program from the memory to implement the instructions of the method according to any one of claims 1-8.
CN201610074686.8A 2016-02-02 2016-02-02 Method and device for ending application program Active CN107025118B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610074686.8A CN107025118B (en) 2016-02-02 2016-02-02 Method and device for ending application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610074686.8A CN107025118B (en) 2016-02-02 2016-02-02 Method and device for ending application program

Publications (2)

Publication Number Publication Date
CN107025118A CN107025118A (en) 2017-08-08
CN107025118B true CN107025118B (en) 2021-05-04

Family

ID=59523988

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610074686.8A Active CN107025118B (en) 2016-02-02 2016-02-02 Method and device for ending application program

Country Status (1)

Country Link
CN (1) CN107025118B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108363529A (en) * 2018-03-20 2018-08-03 青岛海信移动通信技术股份有限公司 The determination method and device of the front stage operation time of Application Program Interface
CN115033306B (en) * 2022-06-29 2024-05-24 维沃移动通信有限公司 Application exit method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902357A (en) * 2012-12-27 2014-07-02 富泰华工业(深圳)有限公司 Application program management system and method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101788926B (en) * 2009-12-28 2014-04-30 中兴通讯股份有限公司 Resource allocation method and device for switching J2ME (Java 2 Micro Edition) application platform
CN102196097A (en) * 2011-05-19 2011-09-21 中兴通讯股份有限公司 Method and device for automatically closing idle programs of mobile communication terminal background

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902357A (en) * 2012-12-27 2014-07-02 富泰华工业(深圳)有限公司 Application program management system and method

Also Published As

Publication number Publication date
CN107025118A (en) 2017-08-08

Similar Documents

Publication Publication Date Title
CN108512695B (en) Method and device for monitoring application blockage
US20170371678A1 (en) Method and apparatus for running game client
CN111343682B (en) Network switching method, device, storage medium and terminal
WO2015090248A1 (en) Server overload protection method and device
CN107302628B (en) Application function control method and related product
CN104423996B (en) View method for refreshing and device
WO2015043403A1 (en) Method, apparatus, and terminal for obtaining video data
CN107332997B (en) Method and device for reducing terminal heating, mobile terminal and storage medium
CN106937258B (en) A kind of control method of broadcast, device and mobile terminal
CN109714476B (en) Data processing method and device, mobile terminal and storage medium
CN106020962B (en) A kind of course control method and terminal device
CN106453908A (en) Double-card network switching method and apparatus based on call and mobile terminal
WO2015081880A1 (en) Method, device and system for processing cluster service attribute
CN109284186A (en) Mobile terminal and its method and apparatus for detecting frame rate adjustment mobile terminal performance
CN103793267A (en) Queue access method and device
CN104426926B (en) The processing method and processing device of data is issued in timing
CN107025118B (en) Method and device for ending application program
CN117407133A (en) Task processing method and device and computer readable storage medium
CN108011860B (en) Method, device and terminal for processing broadcast message
CN106454953B (en) Flow control method, device and terminal
CN111966425A (en) Process cleaning method and device, storage medium and mobile terminal
CN105282628B (en) A kind of method and apparatus of video playing
CN107220344B (en) Document processing method and related product
CN113613310B (en) WIFI connection method and device, storage medium and mobile terminal
CN106708575B (en) Mobile terminal and method and device for loading and running application thereof

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
GR01 Patent grant
GR01 Patent grant