CN106815065B - Background application awakening method and device and electronic equipment - Google Patents

Background application awakening method and device and electronic equipment Download PDF

Info

Publication number
CN106815065B
CN106815065B CN201510851343.3A CN201510851343A CN106815065B CN 106815065 B CN106815065 B CN 106815065B CN 201510851343 A CN201510851343 A CN 201510851343A CN 106815065 B CN106815065 B CN 106815065B
Authority
CN
China
Prior art keywords
thread
sub
target
application
background
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
CN201510851343.3A
Other languages
Chinese (zh)
Other versions
CN106815065A (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 CN201510851343.3A priority Critical patent/CN106815065B/en
Publication of CN106815065A publication Critical patent/CN106815065A/en
Application granted granted Critical
Publication of CN106815065B publication Critical patent/CN106815065B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Telephone Function (AREA)
  • Electric Clocks (AREA)

Abstract

The embodiment provides an embodiment of a wake-up method for background application, which responds to a user's switching to background operation on a target application, switches the target application to the background, and calls a notification method for switching the target application to the background, wherein the notification method comprises a sub-thread creation function and a sub-thread sleep function, the sub-thread creation function is executed to create a sub-thread for the target application, and the sub-thread sleep function is executed to sleep the sub-thread, and when a target wake-up condition is met, the sub-thread is awakened by the embodiment, so that the sub-thread is triggered to wake up the target application switched to the background. Therefore, the embodiment can create and sleep the sub-thread for the target application switched to the background, and wake the background target application by waking the sub-thread after the wake condition is met. In addition, the application also provides a wake-up device and electronic equipment for background application, which are used for ensuring the application and realization of the method in practice.

Description

Background application awakening method and device and electronic equipment
Technical Field
The present application relates to the field of application control technologies, and in particular, to a wake-up method for a background application, a wake-up apparatus for a background application, and an electronic device.
Background
Generally, an application may be installed on an electronic device such as a mobile phone, and the application may provide a corresponding function for a user. The application may be switched to the background of the electronic device, and the application switched to the background may be referred to as a background application.
It can be known that, in order to reduce the consumption of resources of the electronic device, the background application is controlled by the system to enter a dormant state, and the dormant background application may suspend the running of the program, so that if the application wants to resume executing its own program, a technical solution is needed to wake up the background application in the dormant state to implement its own function.
Disclosure of Invention
In view of this, the present application provides a method for waking up a background application, so as to wake up the background application. In addition, the application also provides a wake-up device and electronic equipment for background application, which are used for ensuring the application and realization of the method in practice.
In order to achieve the purpose, the technical scheme provided by the application is as follows:
a first aspect of the present application provides a method for waking up a background application, including:
responding to the operation of a user for switching a target application to a background, switching the target application to the background, and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: creating a sub-thread function and a sub-thread sleep function;
executing the child thread creating function to create a child thread having a binding relationship with the target application;
executing the sub-thread sleep function to sleep the sub-thread, and awakening the sub-thread when a target awakening condition is reached;
and triggering the sub-thread to wake up and switch to the target application of the background.
A second aspect of the present application provides a wake-up apparatus for background applications, including:
the notification method calling module is used for responding to the operation of a user for switching the target application to the background, switching the target application to the background and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: creating a sub-thread function and a sub-thread sleep function;
the sub-thread creating module is used for executing the sub-thread creating function so as to create a sub-thread which has a binding relationship with the target application;
the sub-thread sleep module is used for executing the sub-thread sleep function so as to sleep the sub-thread;
the sub-thread awakening module is used for awakening the sub-thread when a target awakening condition is achieved;
and the sub-thread awakening application module is used for triggering the sub-thread to awaken and switch to the target application of the background.
A third aspect of the present application provides an electronic device, including the wake-up apparatus for background application described above.
As can be seen from the above, the present application has the following advantageous effects:
the embodiment provides a wake-up method embodiment of background application, which responds to a user switching a target application to a background operation, switches the target application to the background, and calls a notification method for switching the target application to the background, wherein the notification method comprises a sub-thread creation function and a sub-thread sleep function, the sub-thread creation function is executed to create a sub-thread for the target application, and the sub-thread sleep function is executed to sleep the sub-thread, when a target wake-up condition is met, the sub-thread is waken up by the embodiment, and then the sub-thread is triggered to wake up the target application switched to the background. Therefore, the embodiment can create and sleep the sub-thread for the target application switched to the background, and wake the background target application by waking the sub-thread after the wake condition is met.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of an embodiment 1 of a wake-up method for a background application provided in the present application;
FIG. 2 is a flow chart of a pre-buried sub-thread manner provided by the present application;
fig. 3 is a flowchart of a wake-up method for a background application according to embodiment 2;
fig. 4 is a schematic structural diagram of a wake-up apparatus for background application according to embodiment 1 of the present application;
fig. 5 is a schematic structural diagram of a wake-up apparatus for background application according to an embodiment 2 of the present application;
fig. 6 is a schematic diagram of a terminal hardware structure provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, a flow of an embodiment 1 of a wake-up method for a background application provided in the present application is shown. As shown in fig. 1, the present embodiment may specifically include the following steps S101 to S104.
Step S101: responding to the operation of a user for switching the target application to the background, and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: a child thread creation function and a child thread sleep function.
The embodiment can be applied to electronic equipment, various applications are installed on the electronic equipment, the applications can be switched to the background from the foreground of the electronic equipment, and the applications entering the background are in a dormant state. In implementation, the application may be switched to the background in the following two ways. Specifically, the method comprises the following steps:
in the first mode, when the application runs in the foreground of the electronic device, the user can trigger the operation of switching the application to the background on the electronic device, so that the application is switched from the foreground to the background. Wherein, the application triggered by the user is the target application.
For example, an alarm clock application is installed in a mobile phone, and a user can set the ringing time and ringing music of the alarm clock in a setting interface and can operate an exit button after the setting is completed to exit the setting interface. It is noted that the exit operation of the user, i.e. the above mentioned switching to the background operation, may generate a switching instruction that controls the alarm clock application to switch from the foreground to the background.
In the second approach, the application is automatically switched from foreground to background. For example, a camera application is installed in the video recording device, and it is assumed that the camera application can automatically generate a switching instruction after the shooting is completed, so that the camera application is switched from a foreground to a background.
It should be noted that, in the above example, the application is switched from the foreground to the background, but the embodiment is not limited to the case of switching from the foreground to the background, and in an actual application, the application may also be switched from another state, such as an unopened state, to the background.
The application is in a dormant state after being switched to the background, and the application needs to be awakened to execute the functional method of the application. Therefore, in order to meet the requirement of such an application, a corresponding notification method for switching to the background can be written in advance in a code file of the application, and the notification method for switching to the background comprises the following steps: a child thread creation function and a child thread sleep function. Alternatively, in an application scenario of the IOS system, the notification method for switching to the background may be an applicationdireterbackground method. In addition, for convenience of description, an application in which such a notification method is written in advance may be referred to as a target application.
If the target application is found to be switched to the background, the embodiment invokes a notification method of the target application, which is switched to the background, to trigger execution of a function in the notification method.
Step S102: a child thread creation function is executed to create a child thread having a binding relationship with the target application.
Specifically, a child thread creation function is first executed, which is used to create child threads that are used to wake up a dormant background application. It should be noted that the child thread creation function is in the notification method for switching to the background of the target application, and therefore, the child thread and the target application have a binding relationship.
Step S103: and executing a sub-thread sleep function to wake the sub-thread when the target wake-up condition is reached by the sleep sub-thread.
After the sub-thread is created, a sub-thread sleep function is executed, and the function is used for sleeping the sub-thread. It should be noted that the created child thread belongs to an application level thread, which does not exist in the underlying system of the electronic device. Thus, a sleep action may be performed thereon. The thread which is put to sleep does not occupy the resources of the electronic equipment, so that the resource consumption can be reduced.
As is clear from the above, the child thread has already been put to sleep, and therefore, it is necessary to wake up the child thread first. Specifically, the state parameters of the threads in the sleep state are monitored, and once the state parameters meet the target wake-up condition, the threads in the sleep state are woken up.
In an implementation, the target wake condition may be a time value or a wake instruction sent externally to the application. For details, please refer to the following, which is not described herein.
Step S104: and triggering the sub-thread to wake up and switch to the target application in the background.
After the sub-thread is awakened, the sub-thread can awaken the target application in the dormant state, and after the target application is awakened, the application operation of the target application can be executed. It should be noted that the application operation indicates a function that the target application itself needs to implement. The functions performed by target applications may differ, and thus the application operations may differ. For example, after the alarm clock application is awakened, a ringing operation is performed; after the camera application is woken up, a photographing operation is performed.
According to the technical scheme, the embodiment provides an embodiment of a wake-up method for background application, which responds to a user switching a target application to a background operation, switches the target application to the background, and calls a notification method for switching the target application to the background, wherein the notification method comprises a sub-thread creation function and a sub-thread sleep function, the sub-thread creation function is executed to create a sub-thread for the target application, and the sub-thread sleep function is executed to sleep the sub-thread, and when a target wake-up condition is met, the embodiment wakes up the sub-thread to trigger the sub-thread to wake-up switching to the background target application. Therefore, the embodiment can create and sleep the sub-thread for the target application switched to the background, and wake the background target application by waking the sub-thread after the wake condition is met.
To summarize, the above wake-up method embodiment 1 for background application may be referred to as a pre-buried sub-thread manner, and a specific flow of the pre-buried sub-thread may refer to fig. 2. As shown in fig. 2, after the application is switched to the background, the main thread of the application enters a sleep state, a sub-thread is created, the sub-thread is controlled to enter the sleep state until a target wake-up condition is met, the sub-thread is woken up, and the woken-up sub-thread wakes up the main thread, so that the main thread executes a corresponding application operation.
It should be noted that the above wake-up method for background application embodiment 1 can be applied in an IOS system. It can be known that the IOS system is a closed system, and the target application switched to the background sleep cannot call the private library in the IOS system, so that the system process provided by the IOS system cannot be called to wake up the target application.
Although the IOS system provides a handleeventforbackgroundardcallback scheme for switching to the application in the background in the dormant state, the callback scheme performs some necessary task processing operations, such as downloading, loading, and the like, after the application is switched to the background. However, these task processing operations are preset in the callback scheme, and most importantly, the task processing operations do not include a wake-up operation, and therefore, the callback scheme cannot be used to wake up the application that is switched to the background.
However, for the closure of the IOS system, the above wake method embodiment 1 of the background application may execute the child thread creation function in the notification method of switching to the background of the target application to create the application level child thread. Different from the system level process of the IOS system, the sub-thread at the application level can be triggered to wake up the target application, so that the problem of how to wake up the application switched to the background in the IOS system is effectively solved.
In practical applications, there are two specific implementations of the sleep and wake sub-threads. The first is that whether the thread needs to be awakened is determined by monitoring the sleeping time of the sub-thread; the second is to wake up the thread according to a target wake-up instruction sent externally by the application. These two implementations are described in detail below.
Regarding the first implementation manner, reference may be made to fig. 3, which illustrates a flow of embodiment 2 of the wake-up method for the background application provided in the present application. As shown in fig. 3, the present embodiment may specifically include steps S201 to S206. It should be noted that, for the description of step S201, step S202, and step S206, reference may be made to the above-mentioned wake-up method embodiment 1 of the background application, which is not described below, and only other steps are described in detail.
Step S201: responding to the operation of a user for switching the target application to the background, and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: a child thread creation function and a child thread sleep function.
Step S202: a child thread creation function is executed to create a child thread having a binding relationship with the target application.
Step S203: a target sleep duration is determined.
The target sleep duration is used as a duration basis for waking up the sub-thread. Optionally, there may be two ways of determining the target sleep duration, which respectively include the following steps a and B.
Step A: and acquiring a time value input by a user as a target sleep time length.
The user can set the sleep duration of the target application in the duration setting interface of the target application, so that the implementation mode determines the duration value set by the user as the target sleep duration.
For example, an alarm clock application is installed on a mobile phone, and a user sets a 3-hour ringing reminder in an alarm clock setting interface, and the implementation mode takes the 3-hour set by the user as a target sleep duration, so that a sub-thread of sleep is awakened after 3 hours, and the alarm clock application can be awakened after the sub-thread is awakened, so that the alarm clock application performs ringing reminder.
And B: and acquiring a preset time value as a target sleep duration.
A default sleep duration value, such as 2 minutes, may be preset in the target application, and of course, this value is merely an illustrative example, and the present application is not limited thereto. The present implementation directly takes the preset time length value as the target sleep time length.
Therefore, the target sleep time length can be determined by the method of the step A or the step B.
Step S204: a sleep to assigned date method is performed to maintain the child thread sleeping for the target sleep duration.
Wherein, the sleep mode of the child thread can be maintained by calling a method of sleeping to a specified date.
Specifically, in the IOS system, the method of sleeping to a specified date is the sleepunintldate method, which means that a child thread is maintained to sleep to a certain point of time. When a method of sleeping to a specified date (sleepUntilDate) is called, a calling parameter is required to be transmitted to the method, and the calling parameter is the sleep deadline. And calling parameters to enable the thread to automatically wake up after sleeping to the sleep deadline.
For example, if the user sets that the alarm application wakes up after 3 hours, and the time when the user makes this setting is 2015, 10, 21, 07 hours and 00 minutes, then when the method of sleeping to the specified date (sleepunintildate) is called, the incoming call parameter is 2015, 10, 21, 10 hours and 00 minutes, so that the method of calling to the specified date (sleepunintildate) wakes up the alarm application 2015, 10, 21, 10 hours and 00 minutes.
In addition, maintaining sub-thread sleep may also be accomplished in other ways. For example, a sleep duration method, namely the sleepForTimeInterval method, is invoked, which represents maintaining the child thread for a certain duration of sleep. Similarly, when the method is called, a call parameter needs to be transmitted to the method, but the call parameter is only the length of the sleep time, and a sleep duration (sleepfreqimeInterval) method can determine the time point to which the thread needs to sleep according to the call parameter.
Also illustrated in the above example, if the sleep duration (sleepportimeinterval) method is invoked, the incoming invocation parameter is 3 hours.
Step S205: and awakening the sub-thread in the sleeping state when the sleeping time of the sub-thread reaches the target sleeping time.
The target sleep time is a condition for waking up the sub-thread, so that the sub-thread is wakened up when the sleep time of the sub-thread reaches the target sleep time.
Step S206: and triggering the sub-thread to wake up and switch to the target application in the background.
In this embodiment, the target sleep duration is used to maintain the sleep of the child thread, and when the sleep duration of the child thread reaches the target sleep duration, the child thread is woken up.
Of course, as above, waking up a sleeping child thread may also use the second implementation. Specifically, the implementation manner of step S103 (waking up the sub-thread when the target wake-up condition is reached) in the above wake-up method embodiment 1 of the background application may be: and responding to the awakening operation of the user on the target application, and awakening the sub-thread.
The electronic device is provided with a target application, the target application can receive a wake-up instruction in real time, and the wake-up instruction can be generated according to a wake-up operation of a user on the target application, or generated by a system of the electronic device, or generated by other applications installed on the electronic device.
For example, the user may wake up the target application by clicking a view key of the background application on the electronic device to make the electronic device display a plurality of background applications running in a current background, where the plurality of applications include the target application, and the user selects the target application to wake up the target application from the background to a foreground. The user selects the operation of the target application in the displayed background applications, namely the awakening operation of the target application.
It can be seen that, unlike the wake method embodiment 2 of the background application, in this implementation, the sub-thread is woken up according to a wake instruction generated by the wake operation of the user.
It should be noted that, in the wake-up method embodiment 2 of the background application, the implementation manner of step S204 (the method of executing sleep to specified date to maintain the child thread to sleep in the target sleep duration) may specifically be the following steps: in the system time management process, the sleep time of the registered sub-thread is the target sleep duration so as to maintain the sub-thread to sleep in the target sleep duration.
Accordingly, in the wake-up method embodiment 2 of the background application, the implementation manner of step S205 (waking up the sub-thread in the sleep state when the sleep duration of the sub-thread reaches the target sleep duration) may specifically be the following steps: and responding to a wake-up instruction of the system time management process, and waking up the sub-thread in the sleep state.
Specifically, in the system of the electronic device, a system time management process is maintained, which is used to provide time-related management functions for the system itself and all applications. The method and the device can realize the sleep and awakening of the created sub-thread by utilizing the management function of the system time management process.
Before the sleep sub-thread, the target sleep duration has been determined, so the sub-thread may be registered with the system time management process and notified of the target sleep duration of the sub-thread. And then, the sub-thread can be controlled to enter a sleep state, and after the system time management process monitors and finds that the target sleep time duration is reached, a wake-up instruction is sent to the sub-thread so as to wake up the sleeping sub-thread.
After the child thread is woken up, it may wake up the target application that is switched to the background. Specifically, the method for notifying the target application to switch to the background includes not only a child thread creating function and a child thread sleeping function, but also a target method of the target application.
Importantly, in the notification method for switching to the background, the functional method is arranged behind the sub-thread sleep function, and the target method of the target application can be executed after the sub-thread sleep function sleeps and wakes up the sub-thread. Therefore, it can be considered that the child thread is bound with the target method of the target application after being woken up.
Accordingly, in the wake-up method for background applications in embodiment 1, the implementation manner of step S104 (triggering the sub-thread to wake up and switch to the target application in the background) may include: after the child thread is woken up, the target method of the target application is executed.
The target method of the target application represents a functional method of the target application, and the specific function of the target application is realized, such as a ringing method of an alarm clock application.
The following describes an embodiment of a wake-up apparatus for background application, and it should be noted that, for the following description of the embodiment of the wake-up apparatus for background application, reference may be made to the above-provided embodiment of the wake-up method for background application, and details are not described below.
Corresponding to the wake-up method embodiment 1 of the background application, the present application provides an embodiment 1 of a wake-up apparatus for background application. As shown in fig. 4, this embodiment may specifically include: a notification method calling module 401, a sub-thread creating module 402, a sub-thread sleeping module 403, a sub-thread awakening module 404 and a sub-thread awakening application module 405; wherein:
the notification method calling module 401 is configured to, in response to a user switching the target application to a background operation, switch the target application to a background and call a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: creating a sub-thread function and a sub-thread sleep function;
a sub-thread creating module 402, configured to execute a sub-thread creating function to create a sub-thread having a binding relationship with a target application;
a sub-thread sleep module 403, configured to execute a sub-thread sleep function to sleep a sub-thread;
a sub-thread wake-up module 404, configured to wake up a sub-thread when a target wake-up condition is reached;
and the sub-thread awakening application module 405 is used for triggering the sub-thread to awaken and switch to the target application of the background.
According to the technical scheme, in the embodiment, the notification method calling module 401 responds to the switching of the target application to the background operation by the user, switches the target application to the background, and calls the notification method for switching the target application to the background, the notification method includes a sub-thread creating function and a sub-thread sleeping function, the sub-thread creating module 402 executes the sub-thread creating function to create the sub-thread for the target application, and the sub-thread sleeping module 403 executes the sub-thread sleeping function to sleep the sub-thread, when the target wake condition is met, the sub-thread waking module 404 wakes up the sub-thread, and then the sub-thread waking application module 405 triggers the sub-thread to wake up the target application switched to the background. Therefore, the embodiment can create and sleep the sub-thread for the target application switched to the background, and wake the background target application by waking the sub-thread after the wake condition is met.
Corresponding to the above wake-up method embodiment 2 of the background application, the present application provides an embodiment 2 of a wake-up apparatus of the background application. As shown in fig. 5, this embodiment may specifically include: the system comprises a notification method calling module 501, a sub-thread creating module 502, a sleep duration determining module 503, a sub-thread sleep sub-module 504, a sub-thread awakening sub-module 505 and a sub-thread awakening application module 506.
It should be noted that, for the description of the notification method invoking module 501, the sub-thread creating module 502, and the sub-thread wake-up application module 506, reference may be made to the above wake-up device embodiment 1 of the background application, which is not described in detail below, and only other modules are described in detail.
A sleep duration determination module 503, configured to determine a target sleep duration.
A sub-thread sleep sub-module 504 for performing a sleep to specified date method to maintain the sub-thread sleeping for the target sleep duration.
Optionally, the sub-thread sleep sub-module 504 specifically includes: the system registers the child thread unit.
Wherein: the system registration sub-thread unit is used for registering the sleep time of the sub-thread as a target sleep duration in a system time management process so as to maintain the sub-thread to sleep within the target sleep duration;
and the sub-thread awakening sub-module 505 is used for awakening the sub-thread in the sleeping state when the sleeping time of the sub-thread reaches the target sleeping time.
Optionally, the sub-thread wake-up sub-module 505 specifically includes: the system wakes up the child thread units.
Wherein: and the system awakening sub-thread unit is used for responding to an awakening instruction of the system time management process and awakening the sub-thread in the sleep state.
In practical applications, the sleep duration determining module 503 in the wake-up apparatus of the background application may specifically include: and a sleep time length determining submodule.
Wherein: the sleep duration determining submodule is used for acquiring a time value input by a user as a target sleep duration; or acquiring a preset time value as the target sleep duration.
In the wake-up apparatus for background application, the sub-thread wake-up module 404 may specifically include: a user operation awakening submodule; wherein:
and the user operation awakening submodule is used for responding to the awakening operation of the user on the target application and awakening the sub-thread.
In the wake-up device for background application, a target method of a target application is bound after a sub-thread is woken up; correspondingly, the sub-thread wake application module 405 may specifically include: the application method executes the sub-module.
The application method execution submodule is used for executing the target method of the target application after the sub-thread is awakened.
In addition, the application also provides an electronic device, which comprises the awakening device of any background application.
The embodiment of the present application further provides a terminal, where the terminal may include the above wake-up method for the background application, and the description of the wake-up method for the background application may refer to the description of the corresponding part above, which is not described herein again.
The hardware structure of the terminal provided in the embodiment of the present application is described below, and the portions related to the wake-up of the background application in the following description may refer to the corresponding portions above. Fig. 6 is a schematic diagram of a hardware structure of a terminal according to an embodiment of the present application, and referring to fig. 6, the terminal may include:
a processor 1, a communication interface 2, a memory 3, a communication bus 4, and a display screen 5;
the processor 1, the communication interface 2, the memory 3 and the display screen 5 are communicated with each other through a communication bus 4;
optionally, the communication interface 2 may be an interface of a communication module, such as an interface of a GSM module;
a processor 1 for executing a program;
a memory 3 for storing a program;
the program may include program code including operating instructions of the processor.
The processor 1 may be a central processing unit CPU or an application specific Integrated circuit asic or one or more Integrated circuits configured to implement embodiments of the present application.
The memory 3 may comprise a high-speed RAM memory, and may further comprise a non-volatile memory (non-volatile memory), such as at least one disk memory.
Among them, the procedure can be specifically used for:
responding to the operation of a user for switching the target application to the background, and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: creating a sub-thread function and a sub-thread sleep function;
executing a child thread creating function to create a child thread having a binding relationship with the target application;
executing a sub-thread sleep function, and awakening the sub-thread when a target awakening condition is reached by the sleep sub-thread;
and triggering the sub-thread to wake up and switch to the target application in the background.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the same element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. A wake-up method for a background application, comprising:
responding to the operation of a user for switching a target application to a background, switching the target application to the background, and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: creating a sub-thread function and a sub-thread sleep function;
executing the child thread creating function to create a child thread having a binding relationship with the target application; the sub-threads are application-level threads;
executing the sub-thread sleep function to sleep the sub-thread, and awakening the sub-thread when a target awakening condition is reached;
and triggering the sub-thread to wake up and switch to the target application of the background.
2. A wake-up method for a background application as claimed in claim 1, wherein waking up the sub-thread when a target wake-up condition is reached comprises:
and responding to the awakening operation of the user on the target application to awaken the sub-thread.
3. The wake-up method for background applications as claimed in claim 1, wherein the method further comprises:
acquiring a time value input by a user as a target sleep duration; or acquiring a preset time value as a target sleep duration;
accordingly, the executing the sub-thread sleep function to sleep the sub-thread includes:
performing a sleep to specified date method to maintain the child thread sleeping for the target sleep duration;
when the target awakening condition is reached, awakening the sub-thread, comprising:
and awakening the sub-thread in the sleeping state when the sleeping time of the sub-thread reaches the target sleeping time.
4. The background application wake-up method of claim 3, wherein the performing a sleep-to-specified-date method to maintain the child thread asleep for the target sleep duration comprises:
in a system time management process, registering the sleep time of the sub-thread as the target sleep time length so as to maintain the sub-thread to sleep within the target sleep time length;
and when the sleeping time of the sub-thread reaches the target sleeping time, awakening the sub-thread in the sleeping state, comprising the following steps:
and responding to a wake-up instruction of the system time management process to wake up the sub-thread in the sleep state.
5. The background application wake-up method according to claim 1, wherein the child thread is bound with a target method of a target application after being woken up;
the triggering of the sub-thread wake-up switching to the target application of the background comprises the following steps:
executing a target method of the target application after the child thread is woken up.
6. A wake-up apparatus for a background application, comprising:
the notification method calling module is used for responding to the operation of a user for switching the target application to the background, switching the target application to the background and calling a notification method for switching the target application to the background; the notification method for switching to the background comprises the following steps: creating a sub-thread function and a sub-thread sleep function;
the sub-thread creating module is used for executing the sub-thread creating function so as to create a sub-thread which has a binding relationship with the target application; the sub-threads are application-level threads;
the sub-thread sleep module is used for executing the sub-thread sleep function so as to sleep the sub-thread;
the sub-thread awakening module is used for awakening the sub-thread when a target awakening condition is achieved;
and the sub-thread awakening application module is used for triggering the sub-thread to awaken and switch to the target application of the background.
7. The wake-up device of the background application as claimed in claim 6, wherein the sub-thread wake-up module comprises:
and the user operation awakening submodule is used for responding to the awakening operation of the target application by the user and awakening the sub-thread.
8. The wake-up apparatus for background applications as claimed in claim 6, wherein the apparatus further comprises:
the sleep duration determining module is used for acquiring a time value input by a user as a target sleep duration; or acquiring a preset time value as a target sleep duration;
the sub-thread sleep module includes:
the sub-thread sleeping submodule is used for executing a method of sleeping to a specified date so as to maintain the sub-thread to sleep in the target sleeping time;
the sub-thread wake-up module comprises:
and the sub-thread awakening submodule is used for awakening the sub-thread in the sleeping state when the sleeping time of the sub-thread reaches the target sleeping time.
9. The wake-up apparatus for background applications as claimed in claim 8, wherein the sub-thread sleep sub-module comprises:
the system registration sub-thread unit is used for registering the sleeping time of the sub-thread as the target sleeping time in a system time management process so as to maintain the sub-thread to sleep within the target sleeping time;
the sub-thread awakening submodule comprises:
and the system awakening sub-thread unit is used for responding to an awakening instruction of the system time management process and awakening the sub-thread in the sleeping state.
10. The background application wake-up apparatus according to claim 6, wherein the child thread is bound with a target method of a target application after being woken up;
the sub-thread wake-up application module comprises:
and the application method execution submodule is used for executing the target method of the target application after the sub-thread is awakened.
11. An electronic device, characterized in that it comprises a wake-up unit of a background application according to any of the claims 6 to 10.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the wake-up method of a background application according to any of the claims 1-5.
CN201510851343.3A 2015-11-27 2015-11-27 Background application awakening method and device and electronic equipment Active CN106815065B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510851343.3A CN106815065B (en) 2015-11-27 2015-11-27 Background application awakening method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510851343.3A CN106815065B (en) 2015-11-27 2015-11-27 Background application awakening method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN106815065A CN106815065A (en) 2017-06-09
CN106815065B true CN106815065B (en) 2020-02-11

Family

ID=59157016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510851343.3A Active CN106815065B (en) 2015-11-27 2015-11-27 Background application awakening method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN106815065B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109213577B (en) * 2017-06-30 2020-09-08 武汉斗鱼网络科技有限公司 Thread sleep method and device and computer equipment
CN109992377B (en) * 2017-12-29 2022-04-15 Oppo广东移动通信有限公司 Information processing method, information processing device, computer equipment and computer readable storage medium
CN108132803B (en) * 2018-01-17 2021-02-12 吉浦斯信息咨询(深圳)有限公司 Timing keep-alive and awakening method, system, terminal and medium based on mobile terminal
CN110321203B (en) * 2018-03-29 2021-07-30 武汉斗鱼网络科技有限公司 Background process false death processing method and client
CN109144600B (en) * 2018-06-21 2021-10-29 连尚(新昌)网络科技有限公司 Application program running method and device and computer readable medium
CN109375995B (en) * 2018-09-26 2021-03-02 Oppo广东移动通信有限公司 Application freezing method and device, storage medium and electronic equipment
CN110413385B (en) * 2019-06-26 2022-10-18 维沃移动通信有限公司 Task management method, terminal device and medium
CN113656085B (en) * 2021-08-20 2023-07-25 亿咖通(湖北)技术有限公司 Meter starting method, apparatus, device, storage medium and program product
CN118034789A (en) * 2022-11-07 2024-05-14 蔚来移动科技有限公司 Process management method, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853180A (en) * 2010-05-25 2010-10-06 中兴通讯股份有限公司 Method for realizing application management and non-intelligent mobile terminal
CN103795554A (en) * 2012-10-29 2014-05-14 华为技术有限公司 Terminal state managing method, device and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9087191B2 (en) * 2012-08-24 2015-07-21 Vmware, Inc. Method and system for facilitating isolated workspace for applications
US20140317579A1 (en) * 2013-04-17 2014-10-23 Mckesson Financial Holdings Methods, apparatuses, and computer program products for application interaction

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853180A (en) * 2010-05-25 2010-10-06 中兴通讯股份有限公司 Method for realizing application management and non-intelligent mobile terminal
CN103795554A (en) * 2012-10-29 2014-05-14 华为技术有限公司 Terminal state managing method, device and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
How to cancel a worker thread in applicationDidEnterBackground on iOS;konran,Tony Million等;《https://stackoverflow.com/questions/5355479/how-to-cancel-a-worker-thread-in-applicationdidenterbackground-on-ios?rq=1》;20110319;第1-3页 *

Also Published As

Publication number Publication date
CN106815065A (en) 2017-06-09

Similar Documents

Publication Publication Date Title
CN106815065B (en) Background application awakening method and device and electronic equipment
CN106662905B (en) Displaying content related to always-on display
CN106484509B (en) Output method and device of popup window and terminal
EP3113549A1 (en) Method and device for waking up mcu chip
CN106256116B (en) A kind of method and terminal controlling application program
WO2017084293A1 (en) Application closing method, device and electronic equipment
CN105373207B (en) A kind of idle method of wireless communication terminal
CN107851050B (en) Device with watchdog timer and method for operating watchdog timer
WO2017211226A1 (en) Method for displaying media file, terminal, and storage medium
CN110058889A (en) A kind of application awakening method and device
US20140282174A1 (en) Silence reminder
KR20150018819A (en) Method for enabling shutdown alarm clock and mobile terminal
CN109656440B (en) Application icon display method, device and medium
CN107783790B (en) Terminal awakening method and device
EP3112979A1 (en) Method and device for waking up mcu
RU2644557C1 (en) Method and device for installing alarm clock
CN107844341B (en) Process starting control method and device, storage medium and mobile terminal
JP2014182512A (en) Frequency control device, frequency control method, and frequency control program
CN114968375A (en) System switching method and device, electronic equipment and readable storage medium
WO2015172283A1 (en) Method, device and mobile terminal for reducing power consumption
CN107231386B (en) Application state conversion method and device and mobile terminal
CN111625322A (en) Data processing method, system and equipment
WO2018076698A1 (en) Terminal delay display method and apparatus, and terminal and computer storage medium
CN116132740A (en) Energy saving method and device for video watching equipment, video watching equipment and readable storage medium
CN105159708A (en) Information processing method and electronic device

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