CN110753086A - Heartbeat awakening method for application and terminal equipment - Google Patents

Heartbeat awakening method for application and terminal equipment Download PDF

Info

Publication number
CN110753086A
CN110753086A CN201910867228.3A CN201910867228A CN110753086A CN 110753086 A CN110753086 A CN 110753086A CN 201910867228 A CN201910867228 A CN 201910867228A CN 110753086 A CN110753086 A CN 110753086A
Authority
CN
China
Prior art keywords
application
terminal device
heartbeat
time
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910867228.3A
Other languages
Chinese (zh)
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201910867228.3A priority Critical patent/CN110753086A/en
Publication of CN110753086A publication Critical patent/CN110753086A/en
Priority to PCT/CN2020/114596 priority patent/WO2021047611A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • 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/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake

Abstract

The application discloses a heartbeat awakening method of an application and a terminal device, relates to the field of computers, and can dynamically adjust the period of awakening the application of the terminal device according to the actual use condition and/or the actual application condition of the terminal device, so that the user experience is improved. In the scheme provided by the application, the terminal device can determine the heartbeat cycle of each application according to one or more of screen-off time, network state information, contextual model information, application type of the application and information such as time information or times of operation of the application in the preset time in the foreground of the terminal device, and the like of the terminal device in the screen-off state, and is used for periodically waking up the corresponding application according to the determined heartbeat cycle so as to trigger the client of the application to send a heartbeat packet to the application server of the application. The method and the device can ensure that the long connection established between the application and the application server of the application is not disconnected, and simultaneously ensure that the electric quantity consumed by the terminal equipment due to the sending of the heartbeat packet is minimized.

Description

Heartbeat awakening method for application and terminal equipment
Technical Field
The embodiment of the application relates to the field of computers, in particular to a heartbeat awakening method and terminal equipment applied to the heartbeat awakening method.
Background
Currently, more and more clients of Applications (APPs) are installed on terminal devices (e.g., mobile phones). After a long connection is established between a client of some applications and an application server of the application, the long connection may be broken if the client of the application and the application server do not communicate for a long time. To avoid the above-mentioned long connection disconnection, the terminal device may periodically wake up the client of the application, as shown in fig. 1A, so that the client of the application sends a heartbeat packet to the application server for reminding the application server to maintain the long connection with the client of the application.
In a conventional method, a terminal device typically wakes up all clients (such as application clients 1 to N shown in fig. 1B, where N is a positive integer) of applications establishing a long connection running in a background of the terminal device periodically according to a fixed heartbeat cycle to trigger the clients of the applications to send heartbeat packets to corresponding application servers, so that the clients of the applications and the application servers maintain a long connection. However, for applications that are not used often by the user, the user is less likely to use the application again, and the need to keep long connections from breaking is less stringent. The method for periodically waking up the client of the application according to the fixed heartbeat cycle can cause the application which is not frequently used to be frequently waken up unnecessarily, thereby wasting the electric quantity of the terminal equipment.
Disclosure of Invention
The embodiment of the application provides a heartbeat awakening method for an application, which can dynamically adjust the period of awakening the application by a terminal device according to the actual use condition of the terminal device and/or the actual condition of the application, and improve user experience.
In order to achieve the above purpose, the embodiment of the present application adopts the following technical solutions:
in a first aspect, a heartbeat wakeup method for an application is provided, where the method is applied to a terminal device, where a plurality of clients for applications are installed in the terminal device, and the method includes: the terminal equipment acquires application indication information of a first application and one or more pieces of information in the use scene information of the terminal equipment in a screen-off state; wherein the first application establishes a long connection with an application server of the first application; the application indication information is used for indicating the application type of the first application and/or time information or times of the first application running in the foreground of the terminal equipment within preset time; the usage scenario information includes: one or more items of screen-off time, network state information and contextual model information of the terminal equipment; the contextual model information is used for indicating that the terminal equipment is in any one of a motion mode, a sleep mode, a pocket mode or a desktop mode; the terminal device determines a heartbeat cycle of the first application according to the application indication information and the use scene information, wherein the heartbeat cycle of the first application is used for periodically waking up the first application so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application.
According to the technical scheme provided by the first aspect, the terminal device may determine the heartbeat cycle of the first application according to one or more of screen-off time, network state information, contextual model information, application type of the first application, time information or frequency of the first application running in the foreground of the terminal device within a preset time and the like when the terminal device is in a screen-off state. By adopting the method, the terminal equipment can dynamically adjust the period of awakening the application by the terminal equipment according to the actual use condition and/or the actual application condition of the terminal equipment, and the user experience is improved.
In one possible implementation, the terminal device includes one or more sensors therein, and the one or more sensors include: at least one of a gyroscope sensor, an acceleration sensor, a magnetic sensor, an ambient light sensor, a proximity light sensor, a distance sensor, and a heart rate sensor; the terminal equipment acquires the contextual model information through the parameters acquired by the one or more sensors. In the scheme, the terminal equipment can determine the contextual model of the terminal equipment through the data acquired by the sensor, so that the terminal equipment can dynamically adjust the period of awakening application of the terminal equipment according to the contextual model of the terminal equipment, and the user experience is improved.
In a possible implementation manner, the network status information is used to indicate that the terminal device is connected to the network or not connected to the network; the network status information is also used to indicate the type of network the terminal device is connected to, and the signal quality of the terminal device if the terminal device is connected to the network. In the scheme, the terminal equipment can dynamically adjust the period of awakening the application of the terminal equipment according to the obtained networking actual condition of the terminal equipment, and the user experience is improved.
In a possible implementation manner, the usage scenario information at least includes: screen-off time of the terminal equipment; after the terminal equipment enters a screen-off state, one or more information of application indication information of the first application and use scene information of the terminal equipment are periodically acquired. In the scheme, the terminal equipment can periodically acquire one or more items of use scene information such as screen-off time, network state information and contextual model information of the terminal equipment, so that the terminal equipment can periodically adjust the period of awakening application of the terminal equipment according to the use scene information of the terminal equipment, and user experience is improved.
In a possible implementation manner, the method further includes: the method comprises the steps that terminal equipment determines a first heartbeat time, wherein the first heartbeat time is from the current time to a first duration of ending time, and the first duration is equal to a heartbeat period of a first application; the terminal equipment starts from a first heartbeat time, periodically wakes up the first application according to a heartbeat cycle of the first application so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application until the client of the first application is disconnected from a long time or the terminal equipment is changed from a screen-off state to a screen-on state. In this scheme, the terminal device may periodically wake up the first application according to the determined heartbeat cycle of the first application, so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application. The long connection established between the first application and the application server of the first application is not disconnected, and meanwhile, the electric quantity consumed by the first application due to the sending of the heartbeat packet can be minimized.
In a possible implementation manner, the method further includes: the method comprises the steps that terminal equipment determines a first heartbeat time, wherein the first heartbeat time is from the current time to a first duration of ending time, and the first duration is equal to a heartbeat period of a first application; after the current moment, the terminal equipment wakes up the first application at the system heartbeat moment closest to the first heartbeat moment so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application; after the terminal device determines the first heartbeat time, the terminal device circularly executes the following steps (1) and (2) until the client of the first application disconnects the long connection or the terminal device changes from the screen-off state to the screen-on state: step (1): the terminal equipment determines the next heartbeat time according to the heartbeat cycle of the first application; step (2): the terminal equipment wakes up the first application at a system heartbeat time closest to the next heartbeat time so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application; the system heartbeat time is determined by the terminal equipment according to a system heartbeat clock started when the terminal equipment is started. In the scheme, the terminal device can determine the heartbeat time of the first application according to the determined heartbeat cycle of the first application, and the heartbeat time of the first application is adjusted to the system heartbeat time according to a preset rule (such as a near alignment principle), so that overlarge power consumption caused by the fact that the heartbeat times of different applications are not distributed in a concentrated mode is avoided.
In a second aspect, a terminal device is provided, in which a plurality of clients of applications are installed, and the terminal device includes: the information acquisition unit is used for acquiring one or more information of application indication information of the first application and use scene information of the terminal equipment when the terminal equipment is in a screen-off state; wherein the first application establishes a long connection with an application server of the first application; the application indication information is used for indicating the application type of the first application and/or time information or times of the first application running in the foreground of the terminal equipment within preset time; the usage scenario information includes: one or more items of screen-off time, network state information and contextual model information of the terminal equipment; the contextual model information is used for indicating that the terminal equipment is in any one of a motion mode, a sleep mode, a pocket mode or a desktop mode; and the analysis unit is used for determining a heartbeat cycle of the first application according to the application indication information and the use scene information, wherein the heartbeat cycle of the first application is used for periodically waking up the first application so as to trigger the client of the first application to send a heartbeat packet to an application server of the first application.
According to the technical scheme provided by the second aspect, the terminal device may determine the heartbeat cycle of the first application according to one or more of screen-off time, network state information, contextual model information, application type of the first application, time information or frequency of the first application running in the foreground of the terminal device within a preset time and the like when the terminal device is in the screen-off state. By adopting the method, the terminal equipment can dynamically adjust the period of awakening the application by the terminal equipment according to the actual use condition and/or the actual application condition of the terminal equipment, and the user experience is improved.
In one possible implementation, the terminal device includes one or more sensors therein, and the one or more sensors include: at least one of a gyroscope sensor, an acceleration sensor, a magnetic sensor, an ambient light sensor, a proximity light sensor, a distance sensor, and a heart rate sensor; the one or more sensors are used for acquiring parameters, so that the information acquisition unit determines the contextual model information according to the parameters. In the scheme, the terminal equipment can determine the contextual model of the terminal equipment through the data acquired by the sensor, so that the terminal equipment can dynamically adjust the period of awakening application of the terminal equipment according to the contextual model of the terminal equipment, and the user experience is improved.
In a possible implementation manner, the network status information is used to indicate that the terminal device is connected to the network or not connected to the network; the network status information is also used to indicate the type of network the terminal device is connected to, and the signal quality of the terminal device if the terminal device is connected to the network. In the scheme, the terminal equipment can dynamically adjust the period of awakening the application of the terminal equipment according to the obtained networking actual condition of the terminal equipment, and the user experience is improved.
In a possible implementation manner, the usage scenario information at least includes: screen-off time of the terminal equipment; the information obtaining unit is configured to periodically obtain one or more pieces of information in the application indication information of the first application and the usage scenario information of the terminal device after the terminal device enters the screen-off state. In the scheme, the terminal equipment can periodically acquire one or more items of use scene information such as screen-off time, network state information and contextual model information of the terminal equipment, so that the terminal equipment can periodically adjust the period of awakening application of the terminal equipment according to the use scene information of the terminal equipment, and user experience is improved.
In a possible implementation manner, the analysis unit is further configured to determine a first heartbeat time, where the first heartbeat time is from a current time to a first expiration time of a first duration, and the first duration is equal to a heartbeat cycle of the first application; the terminal device further includes: and the application awakening unit is used for awakening the first application periodically from the first heartbeat time according to the heartbeat cycle of the first application so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application until the client of the first application is disconnected from the long connection or the terminal equipment is changed from the screen-off state to the screen-on state. In this scheme, the terminal device may periodically wake up the first application according to the determined heartbeat cycle of the first application, so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application. The long connection established between the first application and the application server of the first application is not disconnected, and meanwhile, the electric quantity consumed by the first application due to the sending of the heartbeat packet can be minimized.
In a possible implementation manner, the analysis unit is further configured to determine a first heartbeat time, where the first heartbeat time is from a current time to a first expiration time of a first duration, and the first duration is equal to a heartbeat cycle of the first application; the terminal device further includes: the application awakening unit is used for awakening the first application at a system heartbeat time closest to the first heartbeat time after the current time so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application; after the analysis unit determines the first heartbeat time, the analysis unit and the application wakeup unit are further configured to cyclically execute the following steps (1) and (2) until the client of the first application disconnects the long connection or the terminal device changes from the screen-off state to the screen-on state: step (1): the analysis unit determines the next heartbeat time according to the heartbeat cycle of the first application; step (2): the application awakening unit awakens the first application at a system heartbeat time closest to the next heartbeat time so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application; the system heartbeat time is determined by the terminal equipment according to a system heartbeat clock started when the terminal equipment is started. In the scheme, the terminal device can determine the heartbeat time of the first application according to the determined heartbeat cycle of the first application, and the heartbeat time of the first application is adjusted to the system heartbeat time according to a preset rule (such as a near alignment principle), so that overlarge power consumption caused by the fact that the heartbeat times of different applications are not distributed in a concentrated mode is avoided.
In a third aspect, a terminal device is provided, which includes: a memory for storing one or more computer programs; a radio frequency circuit for transmitting and receiving a radio signal; the processor is used for executing one or more computer programs stored in the memory, so that the terminal equipment obtains one or more information of application indication information of the first application and use scene information of the terminal equipment when the terminal equipment is in a screen-off state; wherein the first application establishes a long connection with an application server of the first application; the application indication information is used for indicating the application type of the first application and/or time information or times of the first application running in the foreground of the terminal equipment within preset time; the usage scenario information includes: one or more items of screen-off time, network state information and contextual model information of the terminal equipment; the contextual model information is used for indicating that the terminal equipment is in any one of a motion mode, a sleep mode, a pocket mode or a desktop mode; and determining a heartbeat cycle of the first application according to the application indication information and the use scene information, wherein the heartbeat cycle of the first application is used for periodically waking up the first application so as to trigger the client of the first application to send a heartbeat packet to an application server of the first application.
According to the technical scheme provided by the third aspect, the terminal device may determine the heartbeat cycle of the first application according to one or more of the screen-off time of the terminal device in the screen-off state, the network state information, the contextual model information, the application type of the first application, the time information or the number of times that the first application runs in the foreground of the terminal device within the preset time, and the like. By adopting the method, the terminal equipment can dynamically adjust the period of awakening the application by the terminal equipment according to the actual use condition and/or the actual application condition of the terminal equipment, and the user experience is improved.
In one possible implementation, the terminal device includes one or more sensors therein, and the one or more sensors include: at least one of a gyroscope sensor, an acceleration sensor, a magnetic sensor, an ambient light sensor, a proximity light sensor, a distance sensor, and a heart rate sensor; the one or more sensors are used for acquiring parameters, so that the information acquisition unit determines the contextual model information according to the parameters. In the scheme, the terminal equipment can determine the contextual model of the terminal equipment through the data acquired by the sensor, so that the terminal equipment can dynamically adjust the period of awakening application of the terminal equipment according to the contextual model of the terminal equipment, and the user experience is improved.
In a possible implementation manner, the network status information is used to indicate that the terminal device is connected to the network or not connected to the network; the network status information is also used to indicate the type of network the terminal device is connected to, and the signal quality of the terminal device if the terminal device is connected to the network. In the scheme, the terminal equipment can dynamically adjust the period of awakening the application of the terminal equipment according to the obtained networking actual condition of the terminal equipment, and the user experience is improved.
In a possible implementation manner, the usage scenario information at least includes: screen-off time of the terminal equipment; the processor is configured to execute one or more computer programs stored in the memory, so that the terminal device periodically obtains one or more pieces of information in the application indication information of the first application and the usage scenario information of the terminal device after the terminal device enters the screen-off state. In the scheme, the terminal equipment can periodically acquire one or more items of use scene information such as screen-off time, network state information and contextual model information of the terminal equipment, so that the terminal equipment can periodically adjust the period of awakening application of the terminal equipment according to the use scene information of the terminal equipment, and user experience is improved.
In a possible implementation, the processor is further configured to execute the one or more computer programs stored in the memory, so that the terminal device determines a first heartbeat time, where the first heartbeat time is from a current time and a first expiration time elapses, and the first expiration time is equal to a heartbeat cycle of the first application; and from the first heartbeat time, periodically waking up the first application according to the heartbeat cycle of the first application to trigger the client of the first application to send a heartbeat packet to the application server of the first application until the client of the first application is disconnected from the long connection or the terminal equipment is changed from the screen-off state to the screen-on state. In this scheme, the terminal device may periodically wake up the first application according to the determined heartbeat cycle of the first application, so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application. The long connection established between the first application and the application server of the first application is not disconnected, and meanwhile, the electric quantity consumed by the first application due to the sending of the heartbeat packet can be minimized.
In a possible implementation, the processor is further configured to execute the one or more computer programs stored in the memory, so that the terminal device determines a first heartbeat time, where the first heartbeat time is from a current time and a first expiration time elapses, and the first expiration time is equal to a heartbeat cycle of the first application; and after the current moment, awakening the first application at a system heartbeat moment closest to the first heartbeat moment so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application; after the terminal device determines the first heartbeat time, the processor is further configured to execute one or more computer programs stored in the memory, so that the terminal device cyclically executes the following steps (1) and (2) until the client of the first application disconnects the long connection or the terminal device changes from the screen-off state to the screen-on state: step (1): determining the next heartbeat time according to the heartbeat period of the first application; step (2): awakening the first application at the system heartbeat time closest to the next heartbeat time so as to trigger the client of the first application to send a heartbeat packet to an application server of the first application; the system heartbeat time is determined by the terminal equipment according to a system heartbeat clock started when the terminal equipment is started. In the scheme, the terminal device can determine the heartbeat time of the first application according to the determined heartbeat cycle of the first application, and the heartbeat time of the first application is adjusted to the system heartbeat time according to a preset rule (such as a near alignment principle), so that overlarge power consumption caused by the fact that the heartbeat times of different applications are not distributed in a concentrated mode is avoided.
In a fourth aspect, a computer-readable storage medium is provided, which has stored thereon computer-executable instructions, which when executed by a processor, implement a heartbeat wakeup method of an application as in any one of the possible implementations of the first aspect.
In a fifth aspect, a chip system is provided, which may include a storage medium to store instructions; and a processing circuit, configured to execute the above instructions to implement the heartbeat wakeup method of the application in any possible implementation manner of the first aspect. The chip system may be formed by a chip, and may also include a chip and other discrete devices.
A sixth aspect provides a computer program product comprising program instructions to implement a heartbeat wakeup method of an application as in any one of the possible implementations of the first aspect when the program instructions are run on a computer. For example, the computer may be at least one storage node.
Drawings
Fig. 1A is a schematic diagram of a client of a terminal device periodically waking up an application according to an embodiment of the present application;
FIG. 1B is a schematic diagram of a conventional heartbeat technique according to an embodiment of the present application;
fig. 2A is a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present disclosure;
fig. 2B is a schematic diagram of a system heartbeat clock according to an embodiment of the present disclosure;
fig. 3 is a first flowchart of a heartbeat wakeup method applied in the embodiment of the present application;
fig. 4 is a schematic diagram illustrating a principle of a method for determining a heartbeat cycle according to an embodiment of the present application;
fig. 5 is a schematic diagram of heartbeat clocks of multiple applications determined by a terminal device according to an embodiment of the present application;
fig. 6 is a flowchart of a heartbeat wakeup method for an application according to an embodiment of the present application;
fig. 7 is a first exemplary diagram for determining a first heartbeat time according to an embodiment of the present application;
fig. 8A is a diagram of an example of determining a first heartbeat time according to an embodiment of the present application;
fig. 8B is a third exemplary diagram for determining a first heartbeat time according to an embodiment of the present application;
fig. 9 is a flowchart of a heartbeat wakeup method applied in the embodiment of the present application;
fig. 10 is a schematic diagram of an application of a heartbeat clock according to an embodiment of the present application;
fig. 11 is a diagram illustrating an example of time alignment of a heartbeat according to an embodiment of the present application;
fig. 12 is a diagram illustrating a comparison between power consumption of a heartbeat wakeup method applied in an embodiment of the present application and power consumption of a conventional heartbeat wakeup method;
fig. 13 is a schematic posture diagram of a terminal device according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a heartbeat awakening method for an application, which is applied to a process that a terminal device periodically awakens a client of the application running in a background in a screen-off state. The terminal device periodically wakes up the client of the application running in the background and is used for triggering the client of the application to send a heartbeat packet to the application server which establishes long connection with the client, so that the client of the application can keep the long connection with the application server.
In the embodiment of the application, foreground running means that the application is currently running in the terminal device, occupies system resources of the terminal device, and currently displays a window interface of the application on a screen of the terminal device. Background running refers to that an application runs in the current terminal equipment, occupies system resources of the terminal equipment, but does not display a related interface on a screen of the terminal equipment at present.
In the embodiment of the present application, the long connection is based on a transmission control Protocol/Internet Protocol (TCP/IP), which is also called TCP connection. It can be understood that during the connection establishment phase of the TCP connection, the client of the application needs to perform three handshakes with the application server (including the first handshake, the second handshake, and the third handshake). The method comprises the steps of establishing TCP connection for connecting with a designated port of AN application server, synchronizing Sequence numbers ((SN), Acknowledgement Numbers (AN), TCP window information and the like) of two sides of the TCP connection, carrying out four handoffs (comprising a first handoff, a second handoff, a third handoff and a fourth handoff) between AN applied client and the application server at a connection dismantling stage of the TCP connection, and releasing the TCP connection between the applied client and the application server.
In some cases, the TCP connection is established on demand, and if the data or signaling transmission between the transmitting and receiving parties is completed, the TCP connection between the transmitting and receiving parties is disconnected. When there is a need for data or signaling transmission next time, the TCP connection is re-established, which is called short connection. However, since the connection establishment phase and the connection removal phase of the TCP connection are complicated, if the TCP connection is frequently disconnected, three-way handshaking is required to establish the TCP connection again when data packet transmission is performed next time, which wastes a certain amount of time and system overhead. Thus, in order to save time and system overhead, a long connection between the client of the application and the application server may be maintained. That is, even if data or signaling transmission between the transmitter and the receiver ends, the TCP connection is not disconnected. Thus, when the data packet needs to be transmitted next time, the data packet can be directly transmitted through the long connection.
In some cases, when the client of the application and the application server maintain a long connection, if the client of the application and the application server do not transmit data or signaling for a long time, the application server may disconnect the long connection with the client for the purpose of saving network resources, and leave more network resources to other devices with transmission requirements. For example, in general, if the client and the application server of the application do not transmit data or signaling within 5 minutes, the application server may disconnect the long connection. Therefore, in order to prevent the long connection between the client of the application and the application server from being disconnected, the terminal device may periodically wake up the application, so that the client of the application periodically sends a heartbeat packet to the application server, so as to ensure that the application server always considers that the long connection is in an active state, thereby avoiding the long connection being disconnected.
In the heartbeat awakening method for the application provided by the embodiment of the application, the terminal device can be a netbook, a tablet computer, an intelligent watch and the like. Alternatively, the terminal device may be other desktop devices, laptop devices, handheld devices, wearable devices, smart home devices, vehicle-mounted devices, and the like having a radio communication function, such as Ultra-mobile Personal computers (UMPCs), smart cameras, netbooks, Personal Digital Assistants (PDAs), Portable Multimedia Players (PMPs), AR (augmented reality)/VR (virtual reality) devices, aircrafts, robots, and the like. The embodiment of the present application does not limit the specific type, structure, and the like of the terminal device.
Referring to fig. 2A, as shown in fig. 2A, a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present application is shown. As shown in fig. 2A, the terminal device 100 may include a processor 210, a memory (including an external memory interface 220 and an internal memory 221), a Universal Serial Bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, keys 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a Subscriber Identity Module (SIM) card interface 295, and the like. The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, an acceleration sensor 280C, a magnetic sensor 280D, an ambient light sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a heart rate sensor 280H, an air pressure sensor, a fingerprint sensor, a temperature sensor, a touch sensor, a bone conduction sensor, and the like.
It is to be understood that the illustrated structure of the embodiment of the present invention does not specifically limit the terminal device 100. In other embodiments of the present application, terminal device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 210 may include one or more processing units, such as: the processor 210 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), among others. The different processing units may be separate devices or may be integrated into one or more processors.
The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 210 for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may hold instructions or data that have just been used or recycled by processor 210. If the processor 210 needs to use the instruction or data again, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 210, thereby increasing the efficiency of the system.
In some embodiments, processor 210 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
It should be understood that the interface connection relationship between the modules according to the embodiment of the present invention is only an exemplary illustration, and does not limit the structure of the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charge management module 240 is configured to receive a charging input from a charger. The charger may be a wireless charger or a wired charger.
The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and/or the charging management module 240, and provides power to the processor 210, the internal memory 221, the display 294, the camera 293, and the wireless communication module 260. The power management module 241 may also be used to monitor parameters such as battery capacity, battery cycle number, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 241 may also be disposed in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 may be disposed in the same device.
The wireless communication function of the terminal device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in terminal device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 250 may provide a solution including 2G/3G/4G/5G wireless communication and the like applied to the terminal device 100. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 250 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 250 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 250 may be disposed in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 250 may be disposed in the same device as at least some of the modules of the processor 210.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 270A, the receiver 270B, etc.) or displays images or video through the display screen 294. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be separate from the processor 210, and may be disposed in the same device as the mobile communication module 250 or other functional modules.
The wireless communication module 260 may provide a solution for wireless communication applied to the terminal device 100, including Wireless Local Area Networks (WLANs), such as Wi-Fi networks, Bluetooth (BT), Global Navigation Satellite Systems (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. The wireless communication module 260 may be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 210. The wireless communication module 260 may also receive a signal to be transmitted from the processor 210, frequency-modulate and amplify the signal, and convert the signal into electromagnetic waves via the antenna 2 to radiate the electromagnetic waves.
In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 250 and the antenna 2 is coupled to the wireless communication module 260, so that the terminal device 100 can communicate with a network and other devices through a wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc.
The terminal device 100 implements a display function through the GPU, the display screen 294, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 294 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 294 is used to display images, video, and the like. The display screen 294 includes a display panel. In some embodiments, the terminal device 100 may include 1 or N display screens 294, N being a positive integer greater than 1.
The terminal device 100 may implement a shooting function through the ISP, the camera 293, the video codec, the GPU, the display screen 294, the application processor, and the like. The ISP is used to process the data fed back by the camera 293. The camera 293 is used to capture still images or video. In some embodiments, the terminal device 100 may include 1 or N cameras 293, where N is a positive integer greater than 1. The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the terminal device 100 selects a frequency point, the digital signal processor is used to perform fourier transform or the like on the frequency point energy.
The external memory interface 220 may be used to connect an external memory card, such as a Micro SD card, to extend the storage capability of the terminal device 100. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function.
Internal memory 221 may be used to store computer-executable program code, including instructions. The internal memory 221 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, a phonebook, etc.) created during use of the terminal device 100, and the like. In addition, the internal memory 221 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like. The processor 210 executes various functional applications of the terminal device 100 and data processing by executing instructions stored in the internal memory 221 and/or instructions stored in a memory provided in the processor.
The terminal device 100 may implement an audio function through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the earphone interface 270D, and the application processor. Such as music playing, recording, etc.
The pressure sensor 280A is used to sense a pressure signal, which can be converted into an electrical signal. In some embodiments, the pressure sensor 280A may be disposed on the display screen 294. The pressure sensor 280A can be of a wide variety of types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 280A, the capacitance between the electrodes changes. The terminal device 100 determines the intensity of the pressure from the change in the capacitance. When a touch operation is applied to the display screen 294, the terminal device 100 detects the intensity of the touch operation based on the pressure sensor 280A. The terminal device 100 can also calculate the touched position from the detection signal of the pressure sensor 280A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The gyro sensor 280B may be used to determine the motion attitude of the terminal device 100. In some embodiments, the angular velocity of terminal device 100 about three axes (i.e., x, y, and z axes) may be determined by gyroscope sensor 280B.
The acceleration sensor 280C can detect the magnitude of acceleration of the terminal device 100 in various directions (generally, three axes). The magnitude and direction of gravity can be detected when the terminal device 100 is stationary. The method can also be used for recognizing the gesture of the terminal equipment 100, and is applied to horizontal and vertical screen switching, pedometers and other applications.
The magnetic sensor 280D is a device that converts a change in the magnetic property of the sensitive element caused by an external factor such as a magnetic field, a current, a stress strain, a temperature, a light, etc. into an electric signal, and in this way, detects a corresponding physical quantity. In some embodiments, the magnetic sensor 280D can measure the angles between the terminal device 100 and the four directions of the south, the west and the north.
The ambient light sensor 280E is used to sense ambient light level. The terminal device 100 may adaptively adjust the brightness of the display screen 294 according to the perceived ambient light level. The ambient light sensor 280E may also be used to automatically adjust the white balance when taking a picture. In some embodiments, the ambient light sensor 280E may also cooperate with a proximity light sensor to detect whether the terminal device 100 is in a pocket to prevent inadvertent contact.
A distance sensor 280F for measuring distance. The terminal device 100 may measure the distance by infrared or laser. In some embodiments, the distance sensor 280F may be used to detect whether there is an obstruction or coverage around the terminal device 100.
The proximity light sensor 280G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The terminal device 100 emits infrared light to the outside through the light emitting diode. The terminal device 100 detects infrared reflected light from a nearby object using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100. When insufficient reflected light is detected, the terminal device 100 can determine that there is no object near the terminal device 100.
The heart rate sensor 280H is used to measure the user's heart rate and other biometric indicators. For example, the heart rate sensor 280H may be an optical heart rate sensor. In some embodiments, heart rate sensor 280H may measure the user's heart rate and other biometric indicators through a wearable device such as a bracelet worn by the user.
Indicator 292 may be an indicator light that may be used to indicate a state of charge, a change in charge, or may be used to indicate a message, missed call, notification, etc.
The keys 290 include a power-on key, a volume key, etc. The keys 290 may be mechanical keys. Or may be touch keys. The motor 291 may generate a vibration cue. Indicator 292 may be an indicator light that may be used to indicate a state of charge, a change in charge, or may be used to indicate a message, missed call, notification, etc. The SIM card interface 295 is used to connect a SIM card. The SIM card can be attached to and detached from the terminal device 100 by being inserted into the SIM card interface 295 or being pulled out from the SIM card interface 295.
As described above, in the conventional method, the terminal device may periodically wake up, according to a fixed heartbeat cycle, all the clients of the applications running in the background of the terminal device and establishing long connection with the application server. For example, the terminal device may periodically wake up the client of the application according to the heartbeat time indicated by the system heartbeat clock.
The system heartbeat clock is set and started by the operating system of the terminal device 100 when the terminal device 100 is powered on, and takes a fixed duration as a periodic heartbeat clock. The system heartbeat clock may be applicable to clients of all applications installed in the terminal device 100. For example, the operating system of millet red rice sets and starts the system heartbeat clock at 8 minutes of the system heartbeat cycle, the operating system of le jin LG 2 sets and starts the system heartbeat clock at 8 minutes of the system heartbeat cycle, and the samsunote 3 sets and starts the system heartbeat clock at 5 minutes of the system heartbeat cycle. As shown in fig. 2B, a schematic diagram of a system heartbeat clock provided in the embodiment of the present application is introduced by taking an example that a system heartbeat cycle of the terminal device 100 is 5 minutes and the terminal device 100 is turned on at 9:00 AM.
However, as described above, the above conventional method may cause the applications that are not used frequently to be woken up unnecessarily frequently, wasting the terminal device power.
In order to solve the above problem, an embodiment of the present application provides an application heartbeat wakeup method, and with this method, a terminal device may determine a heartbeat cycle of at least one application according to one or more information of an actual situation of the at least one application installed in the terminal device 100 and usage scenario information of the terminal device.
The heartbeat awakening method applied in the embodiment of the application can be applied to a terminal device with a hardware structure as shown in fig. 2A or a terminal device with a similar structure. Or the method may also be applied to terminal devices with other structures, which is not limited in this embodiment of the present application. The heartbeat wakeup method for an application provided in the embodiment of the present application is specifically described below with reference to the terminal device 100 shown in fig. 2A. Among them, the terminal device 100 has a plurality of clients of applications installed therein. The terminal device 100 is in the screen-off state.
As shown in fig. 3, the heartbeat wakeup method for an application provided in the embodiment of the present application may include:
s301, the terminal device 100 acquires one or more of application indication information of the first application and usage scenario information of the terminal device 100.
Among them, the terminal device 100 has a plurality of clients of applications installed therein. For example, a client of an application such as "WeChat", "foxmail mailbox", "QQ music", "sharing a bicycle", "Payment treasures", and Baidu maps ". The first application is one of the above-mentioned plurality of applications. The first application runs in the background of the terminal device 100 and establishes a long connection with the application server of the first application.
In an embodiment of the present application, the application indication information of the first application is used to indicate: (A) an application type of the first application; and/or, (B) time information or times of the first application running in the foreground of the terminal equipment within a preset time.
(A) An application type of the first application.
In some embodiments, the application type of the first application may be pre-configured. The terminal device 100 may determine the application type of the first application by analyzing the function of the first application.
The application type of the application can be at least any one of instant messaging, social contact, video and audio, office, news, tools, travel, life and reading. For example, social applications may include "WeChat," "microblog," and "Tencent QQ," among others. Audio and video applications may include "you cool" and "QQ music" among others. Office-like applications may include "microsoft office" and "foxmail mailbox" among others. News-like applications may include "head of the day" and "central news," among others. The tool class applications may include "alarm clock", "calendar", and "weather", among others. The travel-class application may include "Baidu map" and "12306", among others. Lifestyle applications can include "how hungry", "pay for treasure", "share a bike", and "panning", among others. Reading applications may include "bean reading", "southern weekend", "triple week of life", and "world literature famous" and the like. The application types of the application include, but are not limited to, the above several application type examples, which are not limited in this application embodiment.
(B) Time information or times of operation of the first application in the foreground of the terminal device 100 within a preset time.
In this embodiment of the application, the time information of the first application running in the foreground of the terminal device 100 within the preset time is used to represent the time length of the first application running in the foreground of the terminal device 100 within the preset time.
In some embodiments, the time information that the first application runs in the foreground of the terminal device 100 within the preset time may include detailed running time information that the first application runs in the foreground of the terminal device 100 within the preset time (e.g., within the last week).
It can be understood that the terminal device 100 may determine, according to the above detailed running time information of the first application, a time period for the first application to run in the foreground of the terminal device 100 within a preset time. For example, the detailed runtime information that "WeChat" has been running in the foreground of the terminal device 100 during the last week includes: 2019/8/120: 30-2019/8/121: 30, 2019/8/219: 45-2019/8/221: 00, 2019/8/319: 30-2019/8/321: 45, 2019/8/419: 00-2019/8/420: 30, 2019/8/519: 30-2019/8/521: 45, 2019/8/619: 00-2019/8/620: 30 and 2019/8/721: 00-2019/8/722: 12. The terminal device 100 may determine that the "WeChat" is operated in the foreground of the terminal device 100 for 11 hours within a preset time.
Alternatively, the terminal device 100 may determine the runtime rule of the first application and/or the habit of the user to use the first application according to the above detailed runtime information of the first application. For example, the terminal device 100 may determine that the "WeChat" is running within a preset time, typically 19:00 to 22:30 in the evening, according to the detailed running time information of the "WeChat". Therefore, the terminal device 100 can infer that the user is used to use the 'WeChat' at night between 19: 00-22: 30.
In this embodiment of the present application, the usage scenario information of the first application may include: (a) screen-off time of the terminal device 100; (b) network status information of the terminal device 100; (c) at least one of the profile information of the terminal device 100:
(a) the screen-off time of the terminal device 100.
In this embodiment, the screen-off time of the terminal device 100 refers to a time when the terminal device 100 enters a screen-off state; or the time length from the time when the terminal device 100 enters the screen-off state to the current time.
For example, if the screen-off time of the terminal device 100 is "10 minutes", it means that the time period from the time when the terminal device 100 enters the screen-off state to the current time is 10 minutes (i.e., the terminal device 100 has continued to be in the screen-off state for 10 minutes). For another example, if the screen-off time of the terminal device 100 is "11: 30", it indicates that the terminal device 100 enters the screen-off state at 11: 30.
It is understood that the longer the period of time for which the terminal device 100 has been continuously in the off-screen state, the less likely it is that the application installed in the terminal device 100 is currently used. And, the terminal device 100 may determine, according to the time when the terminal device 100 enters the screen-off state, the rule that the terminal device 100 is used by the user and/or the habit of the user using the terminal device 10.
(b) Network status information of the terminal device 100.
Wherein the network status information of the terminal device 100 is used to indicate whether the terminal device 100 is connected to the network or not. The network status information of the terminal device 100 is also used to indicate the type of network the terminal device 100 is connected to, and the signal quality of the network the terminal device 100 is connected to, if the terminal device 100 is connected to the network. The network type to which the terminal device 100 is connected may include, but is not limited to, at least one of a 2G network, a 3G network, a 4G network, a 5G network, and a wireless fidelity (WiFi).
It will be appreciated that if the terminal device 100 is not connected to the network, it is not possible for the client of the first application to maintain a long connection with the application server. In this case, the terminal device 100 does not need to wake up the client of the first application periodically.
In addition, if the terminal device 100 is connected to a network and the terminal device 100 is connected to networks of different network types, the heartbeat cycles of the first application that is periodically woken up are different, which causes different influences on the user. For example, if the terminal device 100 is connected to a 2G network, the client of the first application sends a heartbeat packet to the application server through the 2G network. If the heartbeat period is set too small, an extra traffic cost is caused to the user due to frequent transmission of heartbeat packets. If the terminal device 100 is connected to WiFi, the client of the first application sends a heartbeat packet to the application server through WiFi. If the heartbeat period is set to be too large, a long connection between the client side of the application and the application server may be disconnected due to the too large period, which affects user experience.
(c) Contextual model information of the terminal device 100.
In the embodiment of the present application, the profile information of the terminal device 100 is used to indicate that the terminal device 100 is in any one of a sports mode, a sleeping mode, a pocket mode, or a desktop mode. Here, that the terminal device 100 is in the motion mode means that the terminal device 100 is in a motion state, for example, the terminal device 100 is in a walking state or a running state. The terminal device 100 being in the sleep mode means that the terminal device 100 detects that the user is in a sleep state. The terminal device 100 being in the pocket mode means that the terminal device 100 is placed in a pocket, a bag, or a drawer or the like. The terminal device 100 being in the desktop mode means that the terminal device 100 is resting on a fixed location such as a desktop.
It is understood that the terminal device 100 is in a sport mode, a sleep mode, a pocket mode, or a desktop mode, the less likely that the application installed in the terminal device 100 is currently used. In this case, the terminal device 100 does not have to wake up the client of the first application too frequently. In some embodiments of the present application, the terminal device 100 may determine the contextual model information of the terminal device 100 by analyzing data collected by a sensor provided in the terminal device 100. Wherein the sensor may be at least one of an acceleration sensor, a gyroscope sensor, a magnetic sensor, an ambient light sensor, a distance sensor, and a proximity light sensor. A method and a process for determining the contextual model information of the terminal device 100 by analyzing data collected by a sensor provided in the terminal device 100 will be described in detail below.
It should be noted that the application indication information of the first application is not limited to the application type of the first application or the time information or the number of times that the first application runs in the foreground of the terminal device within the preset time. The usage scenario information of the first application is also not limited to the above-described screen-off time of the terminal device 100, the network state information of the terminal device 100, or the profile information of the terminal device 100. The application indication information of the first application and the usage scenario information of the first application may further include other information, which is not limited in this embodiment.
In some embodiments, the terminal device 100 may periodically acquire one or more of the application indication information of the first application and the usage scenario information of the terminal device 100 after the terminal device 100 enters the screen-off state.
S302, the terminal device 100 determines the heartbeat cycle of the first application according to the application indication information and the usage scenario information.
The heartbeat cycle of the first application is used for the terminal device 100 to periodically wake up the first application to trigger the client of the first application to send a heartbeat packet to the application server of the first application, so that the long connection between the client of the first application and the application server of the first application is maintained.
In some embodiments, the terminal device 100 may be preset with application indication information and/or a corresponding relationship between usage scenario information and a heartbeat cycle. The terminal device 100 may determine the heartbeat cycle of the first application by looking up the correspondence.
Fig. 4 is a schematic diagram illustrating a principle of a method for determining an application heartbeat cycle according to an embodiment of the present application. As shown in fig. 4, the terminal device 100 may determine the heartbeat cycle of the first application by comprehensively considering the application type of the first application, the time information or the number of times that the terminal device 100 runs the first application in the foreground of the terminal device 100 within the preset time, the screen-off time of the terminal device 100, the network state information of the terminal device 100, and the contextual model information of the terminal device 100. Of course, fig. 4 is merely an example. In fact, as described above, the terminal device 100 may determine the heartbeat cycle of the first application according to any one or more of (a), (B), and (c) above. The corresponding relationship between the application indication information and/or the usage scenario information and the heartbeat cycle may be preset in the terminal device 100 in a table form, or may be preset in the terminal device 100 in other forms, which is not limited in the embodiment of the present invention.
For example, table 1 below describes a table format, and the correspondence between the application indication information and/or the usage scenario information preset in the terminal device 100 and the heartbeat cycle is described by taking the correspondence between the "application type", "screen-off time", and the "contextual model" and the heartbeat cycle "preset in the terminal device 100 as an example. The table may be in other forms, and the form of the table is not limited in the embodiment of the present invention.
TABLE 1
Figure BDA0002201619280000131
Wherein, tstepFor heart beat step size, e.g. t step150 seconds(s). As shown in table 1, if the duration of the terminal device 100 in the screen-off state is less than the preset threshold (for example, 10 minutes), the terminal device 100 may set the heartbeat cycle of the social application to 1t regardless of the contextual model of the terminal device 100stepSetting the heartbeat cycle of the life application to 2tstepSetting the heartbeat cycle of the tool application to 1tstep
As shown in table 1, if the duration of the terminal device 100 continuing to turn off the screen is greater than or equal to the preset threshold (e.g., 10 minutes), and the contextual model information of the terminal device 100 indicates that the terminal device 100 is in any one of the motion mode, the sleep mode, the pocket mode or the desktop mode, the terminal device 100 may set the heartbeat cycle of the social application to 2tstepSetting the heartbeat cycle of the life application to 4tstepSetting the heartbeat cycle of the tool application to 2tstep. And if the profile information of the terminal device 100 indicates that the terminal device 100 is in a mode other than the sports mode, the sleep mode, the pocket mode, or the desktop modeIn other scenarios, the terminal device 100 may set the heartbeat cycle of the social application to 1tstepSetting the heartbeat cycle of the life application to 2tstepSetting the heartbeat cycle of the tool application to 1tstep
It can be understood that, if the duration of the terminal device 100 continuing to turn off the screen is greater than or equal to the preset threshold, and the contextual model of the terminal device 100 is any one of the motion mode, the sleep mode, the pocket mode or the desktop mode, the terminal device 100 may predict that the terminal device 100 is not noticed or used by the user for a long period of time. In this case, the terminal device 100 may wake up the application with a relatively large heartbeat cycle.
In addition, if the first application is an instant messaging application, in view of the wide use of instant communication by the user using the terminal device, the terminal device 100 predicts that the first application is more likely to be noticed or used by the user for a longer period of time than other tool type applications or life type applications. Thus, the first application and the type of application may be woken up with a relatively small heartbeat cycle. It should be noted that table 1 is only an example. In some embodiments, in order to avoid an influence of an excessively large heartbeat cycle on some tool applications (e.g., a timer), the terminal device 100 may further wake up the application according to the system heartbeat clock instead of waking up the application according to the heartbeat wakeup method of the application of the embodiment of the present application.
In some embodiments, the terminal device 100 may also be preset with a list of special applications, and for the applications in the list, the applications may be woken up according to the system heartbeat clock.
In addition, in table 1, 10 minutes is taken as an example of the preset threshold, and the preset screen-off duration threshold may also be other values, which is not limited in this application embodiment. In addition, if the duration of the terminal device 100 in the continuously-off state is greater than or equal to the preset threshold, when the terminal device 100 is in different contextual models, the heartbeat cycles of the applications of the same application type may also be different. As shown in table 2, another example of the correspondence relationship between the "application type", the "screen-off time", and the "profile" and the "heartbeat cycle" preset in the terminal device 100 is shown.
TABLE 2
Figure BDA0002201619280000141
Alternatively, as shown in table 3, the preset correspondence relationship in the terminal device 100 may also be a correspondence relationship between "screen-off time", "scene mode", and "foreground operation frequency" and "heartbeat cycle". The "foreground operation frequency degree" is used to represent the frequency degree of the application operating in the foreground of the terminal device 100 within the preset time.
TABLE 3
In some embodiments, the terminal device 100 may determine how frequently the application runs in the foreground of the terminal device 100 within the preset time according to the following rules: if the number of times that the application runs in the foreground of the terminal device 100 within the preset time is greater than a first threshold (for example, 50 times), determining that the application runs at a high frequency; if the number of times that the application runs in the foreground of the terminal device 100 within the preset time is greater than a second threshold (for example, 10 times) and less than or equal to a first threshold (namely, 50 times), determining that the application runs at a low frequency; if the number of times that the application runs in the foreground of the terminal device 100 within the preset time is greater than 0 and less than or equal to a second threshold (i.e. 10 times), determining that the application runs occasionally; if the number of times that the application runs in the foreground of the terminal device 100 within the preset time is equal to 0, it is determined that the application does not run. Alternatively, other methods may also be used to determine how frequently an application runs in the foreground of the terminal device 100 within a preset time, which is not limited in this embodiment of the present application.
Illustratively, assume that the terminal device 100 is in a motion mode, the terminalThe end device 100 is currently in the screen-off state, and the duration of the screen-off state is 12 minutes. In addition, the terminal device 100 determines that the frequency of the "WeChat", "today's first item" and "Taobao" running in the foreground of the terminal device 100 within the preset time is as follows: the ' WeChat ' high-frequency operation, the ' today ' first-line ' low-frequency operation and the ' Taobao ' do not operate. By looking up table 3, the terminal device 100 can determine that the heartbeat period of the WeChat is 2tstepThe heart cycle of the "top of the day" is 3tstepThe heart cycle of the Taobao is 4tstep. Let tstepFig. 5 shows a schematic diagram of the heartbeat clocks of a plurality of applications determined by the terminal device 100 in the embodiment of the present application as 150 s.
In some embodiments, the "foreground run frequency" in table 3 above may also be replaced with a "foreground run number ranking", as shown in table 4.
TABLE 4
Figure BDA0002201619280000152
The "foreground operation frequency ranking" is 1, which indicates that the application has the largest number of operations in the foreground of the terminal device 100 within the preset time. The number of times that the application runs in the foreground of the terminal device 100 within the preset time is less and less represented by 1 to N, where N > 1 and N is an integer. It can be understood that, under the same condition, the higher the "foreground running time ranking" of an application, the higher the possibility that the application is frequently used, and the terminal device 100 may set the heartbeat cycle to be relatively smaller, which may ensure that the long connection between the client of the application and the application server is not disconnected with a higher probability.
For example, assuming that the terminal device 100 is in the motion mode, the terminal device 100 is currently in the screen-off state, and the duration of the screen-off state is 8 minutes. In addition, the terminal device 100 determines that "WeChat", "today's headline" and "Taobao" are inThe ranking of the number of times of foreground operation of the terminal device 100 in the preset time is as follows: "WeChat" ranking 3, today's first item ranking 3, and Taobao' ranking 4. By looking up table 4, terminal device 100 can determine that the heartbeat period of the WeChat is 2tstepThe heart cycle of the "top of the day" is 3tstepThe heart cycle of the Taobao is 4tstep
Alternatively, "foreground run frequency" in table 3 above may be replaced by "foreground run duration ranking". For the specific explanation and description of "foreground run-time ranking", reference may be made to the above specific introduction of "foreground run-time ranking", which is not described herein again.
Alternatively, as shown in table 5, the preset correspondence relationship in the terminal device 100 may also be a correspondence relationship between "network type", "screen-off time", "scene mode", and "foreground operation frequency" and "heartbeat cycle". Here, the "network type" is used to characterize the type of network to which the terminal device 100 is connected.
TABLE 5
Figure BDA0002201619280000162
Figure BDA0002201619280000171
In some embodiments, if the network status information of the terminal device 100 indicates that the terminal device 100 is not connected to the network, the terminal device 100 may abandon the execution S302, that is, the terminal device 100 abandons the determination of the heartbeat cycle of the first application. Until the terminal device 100 connects to the network, the terminal device 100 re-acquires the application indication information and/or the usage scenario information (i.e., re-executes S301), and then determines the heartbeat cycle of the first application according to the re-determined application indication information and/or usage scenario information.
It should be noted that table 1, table 2, table 3, table 4, and table 5 are only examples of correspondence between application indication information and usage scenario information preset in several types of terminal devices 100 and a heartbeat cycle. The corresponding relationship is not specifically limited in the embodiment of the present application, that is, the corresponding relationship may be a corresponding relationship between any one or more of "application type", "screen-off time long", "contextual model", "foreground operation frequency" (or "foreground operation time ranking"/"foreground operation frequency ranking"), "network type" and other application indication information and usage scenario information, and "heartbeat cycle".
In some embodiments, the terminal device 100 may further analyze the application indication information of the first application acquired by the terminal device 100 in S301 and the usage scenario information of the terminal device 100, and predict an operation rule of the first application in a preset time period.
For example, the terminal device 100 may determine the operation rule of the first application in the preset time according to the time information that the terminal device 100 acquires in S301 that the first application is operated in the foreground of the terminal device 100 within the preset time. For example, as described above, the terminal device 100 may determine the high frequency time period in which the "WeChat" operates in the foreground of the terminal device 100 in the last week time, based on the detailed operation time in which the "WeChat" operates in the foreground of the terminal device 100 in the last week time. Is 19: 00-22: 30 at night. Namely, the terminal device 100 can predict that the user is used to use the 'WeChat' at night between 19:00 and 22: 30. In this case, the terminal device 100 may set the heartbeat period of the wechat between 19:00 and 22:30 at night every day to be smaller, so as to ensure that the long connection between the wechat client and the application server is not disconnected with a higher probability.
For example, the terminal device 100 may predict the possibility that the first application is running in the foreground within a preset time period according to a specific function of the first application. For example, the first application is mainly used for ordering take-out, and the terminal device 100 may predict that the first application is more likely to be operated in the foreground during the lunch time period (e.g., 11: 00-13: 00) and the dinner time period (e.g., 18: 00-20: 00) according to the specific function of the first application. In this case, the terminal device 100 may set the heartbeat cycle of the first application to be small in the lunch time period and the dinner time period to ensure with a greater probability that the long connection between the client of the first application and the application server is not disconnected during the above time period.
Further, as shown in fig. 6, the heartbeat wakeup method for an application provided in the embodiment of the present application may further include:
s603, the terminal device 100 determines the first heartbeat time.
In some embodiments, the first heartbeat time may be at a first duration expiration time T1 from the current time T.
Assume that the first application has a heartbeat period of T. Referring to fig. 7, as shown in fig. 7, the current time is time t. The terminal device 100 determines the first heartbeat time T1 as the expiration time T1 of the time period T elapsed from the time T. Where, T1 is T + T.
In other embodiments, if the first application has a heartbeat cycle greater than or equal to the duration from the previous heartbeat time T00 to the current time, the first heartbeat time is from the previous heartbeat time T00 at the current time T0 past the expiration time T1 of the first duration. Wherein the first duration is equal to a heartbeat cycle of the first application. When S601, S602, and S603 are performed for the first time after the terminal device 100 turns off the screen to determine the first heartbeat time, the previous heartbeat time T00 is the heartbeat time indicated by the system heartbeat clock.
Referring to fig. 8A, as shown in fig. 8A, the current time is time t. At the time T, the terminal device 100 determines that the heartbeat period T of the first application is greater than or equal to the duration from the previous heartbeat time T00 to the current time T, i.e. T ≧ T (T-T00). The terminal device 100 determines that the first heartbeat time is the expiration time T1 of the time period T elapsed from the previous heartbeat time T00 of the time T. Wherein, T1 is T00+ T.
If the heartbeat period T of the first application is less than the duration from the previous heartbeat time T00 to the current time T, i.e. T < (T-T00), the first heartbeat time is from the next heartbeat time T11 of the current time T0, and the expiration time T1 of the first duration T elapses. Referring to fig. 8B, as shown in fig. 8B, the current time is time t. At time T, the terminal device 100 determines that the heartbeat cycle T of the first application is less than the duration from the previous heartbeat time T00 to the current time T, i.e., T < (T-T00). The terminal device 100 determines that the first heartbeat time is the expiration time T1 of the time period T elapsed from the subsequent heartbeat time T11 of the time T. Wherein, T1 is T11+ T.
In some embodiments, as shown in fig. 6, after the terminal device 100 executes S603, the method for waking up a heartbeat of an application provided in the embodiment of the present application may further include:
s604, the terminal device 100 starts from the first heartbeat time, and periodically wakes up the first application according to the heartbeat cycle of the first application.
The terminal device 100 wakes up the first application periodically for triggering the client of the first application to send the heartbeat packet to the application server of the first application. The terminal device 100 may continue to wake up the first application periodically until the client of the first application disconnects or the terminal device 100 lights up. As shown in fig. 7, 8A, and 8B, the terminal device 100 wakes up the first application at times T1, T2 … …, and the like in sequence.
It is understood that if the client of the first application disconnects the long connection, it does not make sense for the client of the first application to send a heartbeat packet to the application server of the first application even if the terminal device 100 wakes up the client of the first application. When the first application needs to transfer data with the application server of the first application, a long connection between the first application and the application server of the first application needs to be re-established.
In addition, in some embodiments, when the terminal device 100 is in the bright screen state, the terminal device 100 uses the system heartbeat clock as a reference for applying the heartbeat timing. It is understood that when the terminal device 100 is in the bright screen state, the terminal device 100 generally does not interfere too much with the heartbeat cycle of the application in order to ensure the best representation of the functions of all applications. Therefore, if the terminal device 100 changes from the screen-off state to the screen-on state, as shown in fig. 8, after the terminal device 100 changes from the screen-off state to the screen-on state, the terminal device 100 may end the heartbeat wakeup method of the application provided in the embodiment of the present application. And periodically waking up the first application by using a system heartbeat clock as a reference for the application heartbeat opportunity.
S605, the terminal device 100 determines whether the client of the first application is disconnected from the long connection or whether the terminal device 100 turns off the screen to the bright screen. If so, the terminal device 100 executes S606.
S606, the terminal device 100 stops according to the heartbeat cycle of the first application, and periodically wakes up the first application.
In other embodiments, as shown in fig. 9, after the terminal device 100 executes S603, the method for waking up a heartbeat of an application according to the embodiment of the present application may further include:
s904, the terminal device 100 aligns the first heartbeat time to the second heartbeat time.
The second heartbeat time is used for the terminal device 100 to wake up the first application at the second heartbeat time, so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application.
It will be appreciated that since the heartbeat cycles of different applications may be different, the next application heartbeat time for different applications may be different. Illustratively, as shown in fig. 10, the heartbeat times t1, t2 and t3 of the next application of "WeChat", "today's head bar" and "Taobao" are all different. Wherein t1 is t0+300s, t2 is t0+450s, and t3 is t0+600 s. That is, in the case shown in fig. 10, the terminal device 100 needs to wake up "WeChat" at time t1, then wake up "today's head at time t2, and wake up" Taobao "at time t 3. The terminal device 100 needs to operate frequently for the wake-up application, which obviously is disadvantageous for saving power of the terminal device 100.
Therefore, in order to balance the power consumption saving and the user experience of the terminal device 100, in some embodiments of the present application, the terminal device 100 may align the heartbeat time of the first application to the previous heartbeat time or the next heartbeat time of the heartbeat time.
In some embodiments, the terminal device 100 may align the heartbeat time of the first application to a previous heartbeat time or a next heartbeat time of the heartbeat time according to a preset condition. Wherein the preset condition may be a preset alignment manner. The preset alignment mode at least comprises leftward alignment, rightward alignment and close alignment. Alternatively, the preset condition may also be other conditions or rules, which are not limited in the embodiment of the present application.
In some embodiments, the terminal device 100 may align the heartbeat time of the first application to a previous system heartbeat time or a next system heartbeat time of the heartbeat time according to a preset condition.
For example, the preset alignment manner is a near alignment, and the terminal device 100 may align the first heartbeat time T1 of the first application to the system heartbeat time closest to the first heartbeat time T1 according to the near alignment rule. As shown in fig. 11 (a), the system heartbeat time closest to the first heartbeat time T1 is T22. The terminal device 100 may align the first heartbeat time T1 of the first application to the system heartbeat time T22. That is, the terminal device 100 wakes up the first application at time T22.
If the preset alignment manner is rightward alignment, the terminal device 100 may align the first heartbeat time T1 of the first application to the first system heartbeat time after the first heartbeat time T1 according to the rightward alignment rule. As shown in (b) of fig. 11, the first system heartbeat time after the first heartbeat time T1 is T22. Terminal device 100 may align first heartbeat time T1 of the first application to system heartbeat time Talarm(T22). That is, the terminal device 100 wakes up the first application at time T22.
If the alignment mode is left alignment, the terminal device 100 may align the first heartbeat time T1 of the first application to the latest system heartbeat time before the first heartbeat time T1 according to the left alignment rule. As shown in (c) of fig. 11, the last system heartbeat time before the first heartbeat time T1 is T11. Terminal device 100 may align first heartbeat time T1 of the first application to system heartbeat time Talarm(T11). That is, the terminal device 100 wakes up the first application at time T11.
In some embodiments, the terminal device 100 may count the heartbeat time of all applications that the terminal device 100 wakes up periodically. The preset condition is determined by combining the number of applications scheduled to be woken up by the terminal device 100 at the first heartbeat time T1, and the number of applications scheduled to be woken up by the terminal device 100 at the previous system heartbeat time T1 and the next system heartbeat time T1. Alternatively, the preset condition may also be determined according to other conditions or rules, which is not limited in the embodiment of the present application.
Illustratively, the terminal device 100 plans to wake up 5 applications at the first heartbeat time T1, 3 applications at the previous system heartbeat time T1, and 8 applications at the next system heartbeat time T1. In this case, the terminal device 100 may set the alignment of the first heartbeat time T1 to be right alignment. All applications that are scheduled to wake up at this time are aligned to the right to wake up at the time of the last system heartbeat at T1.
S905, the terminal device 100 determines the next heartbeat time.
The terminal device 100 may determine the next heartbeat time according to the heartbeat cycle T of the first application.
Illustratively, if the last heartbeat time was the first heartbeat time T1, then the next heartbeat time is after the first heartbeat time T1, separated from the first heartbeat time T1 by the heartbeat cycle T of the first application.
S906, the terminal device 100 aligns the next heartbeat time after the first heartbeat time of the first application to the system heartbeat time by using the same method as S904.
The terminal device 100 aligns the next heartbeat time after the first heartbeat time of the first application to the system heartbeat time, and is configured to wake up the first application at the system heartbeat time to trigger the client of the first application to send a heartbeat packet to the application server of the first application.
S907, the terminal device 100 determines whether the client of the first application is disconnected from the long connection or whether the terminal device 100 turns off the screen to the bright screen.
If so, the terminal device 100 executes S908.
If not, the terminal device 100 re-executes S905, S906, and S907. And sequentially determining each heartbeat time by adopting the same method. Such as T2 and T3 in fig. 11 (a), fig. 11 (b), and fig. 11 (c), and the like.
S908, the terminal device 100 stops according to the heartbeat cycle of the first application, and periodically wakes up the first application.
As described above, it can be appreciated that the client of the first application cannot send heartbeat packets to the application server of the first application when the client of the first application disconnects from the long connection. Accordingly, the terminal device 100 may stop periodically waking up the client of the first application. When the terminal device 100 changes from the screen-off state to the screen-on state, in order to ensure the best embodiment of the first application function, the terminal device 100 may end the heartbeat wakeup method of the application provided in the embodiment of the present application. And periodically waking up the first application by using a system heartbeat clock as a reference for the application heartbeat opportunity.
By adopting the heartbeat awakening method for the application, provided by the embodiment of the application, the requirement of dynamically adjusting the heartbeat period of the application according to one or more of the actual conditions of the application, the use scene information of the terminal equipment and the like can be met. And the power consumption of the terminal equipment in the screen-off state can be reduced. Fig. 12 is a diagram illustrating a comparison between power consumption of a heartbeat wakeup method using an application provided in an embodiment of the present application and power consumption of a conventional heartbeat wakeup method. Fig. 12 (a) shows output current statistics of a conventional heartbeat wake-up method for a certain time. Fig. 12 (b) shows the output current statistics of the heartbeat wakeup method applied in the embodiment of the present application over a certain time. It is understood that the operating voltage of a terminal device is fixed, and the magnitude of the output current reflects the power consumption of the terminal device. As shown in fig. 12 (a), the terminal device wakes up the application disorderly by using the conventional heartbeat wakeup method. By adopting the heartbeat awakening method for the application provided by the embodiment of the application, the terminal equipment awakening application is relatively regular. Fig. 12 (c) shows a power consumption comparison result of the heartbeat wakeup method applied by the embodiment of the present application and the conventional heartbeat wakeup method. As can be seen from fig. 12 (a), fig. 12 (b), and fig. 12 (c), by using the heartbeat wakeup method applied in the embodiment of the present application, power consumption of the terminal device in the screen-off state is greatly reduced.
In some embodiments of the present application, the terminal device 100 may collect first data through a sensor provided in the terminal device 100, and analyze the first data, so as to determine the contextual model information of the terminal device 100. Wherein the sensor may be at least one of an acceleration sensor, a gyroscope sensor, a magnetic sensor, an ambient light sensor, a distance sensor, and a proximity light sensor.
In one implementation, the terminal device 100 may determine the posture of the terminal device 100 by analyzing data collected by the acceleration sensor and/or the magnetic sensor, and the gyroscope sensor, and then determine the contextual model information of the terminal device 100 according to the posture of the terminal device 100. The attitude of the terminal device 100 at least includes a moving direction and a moving speed of the terminal device 100, and a yaw angle (yaw), a pitch angle (pitch), and a roll angle (roll) of the terminal device 100 with respect to a ground coordinate system.
The acceleration sensor comprises a mass block, a sensitive element and other components. The working principle of the acceleration sensor is as follows: the sensing element converts the inertial force applied to the mass block into an electrical signal, and thus, the translation direction and the translation speed of the terminal device 100 are determined according to the electrical signal converted from the stress condition of the mass block. Wherein, the atress condition of quality piece shows: the force-bearing direction of the mass block and the acceleration of the mass block in the force-bearing direction. The force-receiving direction of the mass block may include: x along a three-dimensional coordinate systembAxis, ybAxis and zbSix directions on three axes, i.e. + xb,-xb,+yb,-yb,+zbAnd-zbAnd (4) direction. Therefore, in the first data, the data collected by the acceleration sensor may be a translation direction of the terminal device and a translation speed at which the terminal device moves along the translation direction.
The gyroscope sensor comprises a gyroscope rotor, a driving motor and the like. The operation principle of the gyro sensor is that the driving motor drives the gyro rotor to rotate around the rotation axis, and the rotation angle of the terminal device 100 and the rotation angular velocity of the terminal device 100 are determined by measuring the angle between the rotation axis of the gyro rotor and the three-dimensional coordinate system (including the X axis, the Y axis, and the Z axis) of the terminal device 100 and the angular velocity of the gyro rotor.
The principle of the magnetic sensor is similar to that of a compass, and the included angles between the terminal device 100 and the south, the west and the north can be measured.
That is, the acceleration sensor may measure "how far the terminal device 100 has moved along the X axis", the gyro sensor may measure "the terminal device 100 has turned around", and the magnetic sensor may measure "the terminal device 100 moves westward".
Referring to fig. 13, as shown in fig. 3, a schematic diagram of an attitude of a terminal device 100 according to an embodiment of the present application is shown. As shown in fig. 13, xbAxis, ybAxis, zbThe axes and the origin O constitute a coordinate system of the terminal device 100. x is the number ofgAxis, ygAxis, zgThe axes and origin O constitute the ground coordinate system. Where O is the center of mass of the terminal device 100, xbThe axis is directed towards the head of the terminal device 100 in the plane of symmetry of the terminal device 100 and parallel to the axis of the body of the terminal device 100. y isbAxis perpendicular to xbThe axis points to the right of the terminal device 100. z is a radical ofbAxis perpendicular to xbAn axis and points below the body of the terminal device 100. x is the number ofgThe axis is in the horizontal plane and points in a certain direction. z is a radical ofgThe axis is perpendicular to the ground and directed towards the center of the earth. y isgThe axis being perpendicular to x in the horizontal planegThe axis, the pointing direction of which is determined according to the right-hand rule.
As shown in fig. 13, the yaw angle refers to x corresponding to the terminal device 100bProjection of axis on horizontal plane and ground coordinate system xgAngle between axesWith the front end portion of the terminal device 100 deflected to the right being positive. The pitch angle refers to x corresponding to the terminal device 100bThe angle θ between the axis and the ground plane (or horizontal plane) is positive with the front end portion of the terminal device 100 deflected upward. The roll angle is z corresponding to the terminal device 100bAxle and pass-through terminal 100xbBetween the vertical planes of the shaftsThe angle phi of (c) is positive with the terminal device 100 rolling right.
Illustratively, the terminal device 100 determines that the movement speed of the terminal device 100 is 0 m/s, and the pitch angle θ of the terminal device 100 is 0 and the roll angle Φ is 0 by analyzing the first data collected by the acceleration sensor, the magnetic sensor, and the gyro sensor. The terminal device 100 may determine that it is in the desktop mode.
As a further example, the westward movement of the terminal device 100 is determined at the terminal device 100 by analyzing data collected by the acceleration sensor, and the movement speed is 6 m/s. The terminal device 100 may determine that it is in the motion mode. In this case, in some embodiments, the terminal device may ignore the yaw angle of the terminal device 100
Figure BDA0002201619280000212
Pitch angle θ and roll angle φ.
Further, the terminal device 100 may further be in a running mode, a walking mode, or a riding mode according to a speed range corresponding to a running mode preset in the terminal device 100. For example, if the speed range corresponding to the running mode preset in the terminal device 100 is 3 m/s to 12 m/s, the terminal device 100 may determine that it is in the running mode.
In another implementation manner, the terminal device 100 may further determine environment information where the terminal device 100 is located by analyzing data collected by an ambient light sensor, a distance sensor, or a proximity light sensor, and then determine the contextual model information of the terminal device 100 according to the environment information of the terminal device 100.
For example, the terminal device 100 determines that the ambient light level at which the terminal device 100 is located is very dark through an ambient light sensor, and in addition, determines that the screen of the terminal device is blocked by other objects in combination with data collected by a distance sensor or a proximity light sensor. Combining the above results, the terminal device 100 can determine that it is in the pocket mode.
In other embodiments, the terminal device 100 may determine the heart rate information of the user by analyzing the data collected by the heart rate sensor, and then determine the contextual model information of the terminal device 100 according to the heart rate information of the user.
For example, the terminal device 100 analyzes heart rate information of the user collected by a heart rate sensor, and determines that the heart rate information matches a preset heart rate of the person in a sleep state. In this case, the terminal device 100 may consider the terminal device not to be used by the user, and the terminal device 100 may determine that the terminal device 100 is in the sleep mode. The heart rate sensor of the terminal device 100 may collect heart rate information of the user through the bracelet.
It should be noted that, in the embodiment of the present application, the contextual model of the terminal device 100 may be determined by comprehensively analyzing data collected by a plurality of sensors. For example, when the terminal device 100 determines that the terminal device 100 is in the sport mode by analyzing the first data collected by the acceleration sensor, the magnetic sensor, and the gyroscope sensor, the terminal device 100 may further determine, in combination with a biometric indicator such as a heart rate of the user detected by the heart rate sensor, whether the terminal device 100 is in the running mode, the walking mode, or the riding mode. For example, the data such as the heart rate of the user detected by the heart rate sensor corresponds to the biometric index range of a regular person when running, which is configured in advance in the terminal device 100, in this case, the terminal device 100 may determine that it is in the running mode.
It is to be understood that the terminal device includes a hardware structure and/or a software module for performing each function in order to realize the functions of any one of the above embodiments. Those of skill in the art would readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional modules of the terminal device, for example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, in the embodiment of the present application, the division of the module is schematic, and is only one logic function division, and there may be another division manner in actual implementation.
For example, taking dividing each functional module in an integrated manner as an example, as shown in fig. 14, a schematic structural diagram of a terminal device provided in the embodiment of the present application is shown. The terminal device 100 may include an information acquisition unit 1410, an analysis unit 1420, and an application wakeup unit 1430.
Wherein information acquisition unit 1410 is configured to support terminal device 100 to perform S301, and/or other processes for the techniques described herein. The analysis unit 1420 is used to support the terminal device 100 to perform S302, S603, S605, S904, S905, S906, and S907, and/or other processes for the techniques described herein. The application wakeup unit 1430 is used to support the terminal device 100 performing S604 and S908, and/or other processes for the techniques described herein.
It should be noted that all relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
In an alternative, when the data transfer is implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are implemented in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware or may be embodied in software instructions executed by a processor. The software instructions may consist of corresponding software modules that may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an ASIC. In addition, the ASIC may reside in a probing apparatus. Of course, the processor and the storage medium may reside as discrete components in the probe device.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed user equipment and method may be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A heartbeat awakening method of an application is applied to a terminal device, a plurality of client sides of the application are installed in the terminal device, and the method comprises the following steps:
the method comprises the steps that the terminal equipment obtains one or more information of application indication information of a first application and use scene information of the terminal equipment in a screen extinguishing state; wherein the first application establishes a long connection with an application server of the first application; the application indication information is used for indicating the application type of the first application and/or time information or times of the first application running in the foreground of the terminal equipment within preset time; the usage scenario information includes: one or more items of screen-off time, network state information and contextual model information of the terminal equipment; the contextual model information is used for indicating that the terminal equipment is in any one of a motion mode, a sleep mode, a pocket mode or a desktop mode;
the terminal device determines a heartbeat cycle of the first application according to the application indication information and the usage scenario information, wherein the heartbeat cycle of the first application is used for periodically waking up the first application so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application.
2. The method of claim 1, wherein one or more sensors are included in the terminal device, and wherein the one or more sensors comprise: at least one of a gyroscope sensor, an acceleration sensor, a magnetic sensor, an ambient light sensor, a proximity light sensor, a distance sensor, and a heart rate sensor;
and the terminal equipment acquires the contextual model information through the parameters acquired by the one or more sensors.
3. The method according to claim 1 or 2, wherein the network status information is used to indicate whether the terminal device is connected to a network or not connected to a network;
the network status information is further used to indicate a network type to which the terminal device is connected and a signal quality of the terminal device if the terminal device is connected to a network.
4. The method according to any of claims 1-3, wherein the usage scenario information comprises at least: the screen-off time of the terminal equipment;
and after the terminal equipment enters the screen extinguishing state, periodically acquiring one or more information in the application indication information of the first application and the use scene information of the terminal equipment.
5. The method according to any one of claims 1-4, further comprising:
the terminal equipment determines a first heartbeat time, wherein the first heartbeat time is from the current time and passes through a first duration ending time, and the first duration is equal to the heartbeat period of the first application;
and the terminal equipment periodically wakes up the first application from the first heartbeat time according to the heartbeat cycle of the first application to trigger the client of the first application to send a heartbeat packet to the application server of the first application until the client of the first application is disconnected from the long connection or the terminal equipment is changed from the screen-off state to the screen-on state.
6. The method according to any one of claims 1-4, further comprising:
the terminal equipment determines a first heartbeat time, wherein the first heartbeat time is from the current time and passes through a first duration ending time, and the first duration is equal to the heartbeat period of the first application;
the terminal equipment wakes up the first application at a system heartbeat time which is closest to the first heartbeat time after the current time so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application;
after the terminal device determines a first heartbeat time, the terminal device executes the following steps (1) and (2) in a circulating manner until the client of the first application disconnects the long connection or the terminal device changes from the screen-off state to the screen-on state:
step (1): the terminal equipment determines the next heartbeat time according to the heartbeat cycle of the first application;
step (2): the terminal equipment wakes up the first application at a system heartbeat time closest to the next heartbeat time so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application; and the system heartbeat time is determined by the terminal equipment according to a system heartbeat clock started when the terminal equipment is started.
7. A terminal device, wherein a plurality of clients of applications are installed in the terminal device, the terminal device comprising:
the information acquisition unit is used for acquiring one or more information of application indication information of a first application and use scene information of the terminal equipment when the terminal equipment is in a screen-off state; wherein the first application establishes a long connection with an application server of the first application; the application indication information is used for indicating the application type of the first application and/or time information or times of the first application running in the foreground of the terminal equipment within preset time; the usage scenario information includes: one or more items of screen-off time, network state information and contextual model information of the terminal equipment; the contextual model information is used for indicating that the terminal equipment is in any one of a motion mode, a sleep mode, a pocket mode or a desktop mode;
an analysis unit, configured to determine a heartbeat cycle of the first application according to the application indication information and the usage scenario information, where the heartbeat cycle of the first application is used to periodically wake up the first application, so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application.
8. The terminal device of claim 7, further comprising a sensor unit, the sensor unit comprising one or more sensors, the one or more sensors comprising: at least one of a gyroscope sensor, an acceleration sensor, a magnetic sensor, an ambient light sensor, a proximity light sensor, a distance sensor, and a heart rate sensor;
the one or more sensors are used for acquiring parameters, so that the information acquisition unit determines the contextual model information according to the parameters.
9. The terminal device according to claim 7 or 8, wherein the network status information is used to indicate whether the terminal device is connected to a network or not connected to a network;
the network status information is further used to indicate a network type to which the terminal device is connected and a signal quality of the terminal device if the terminal device is connected to a network.
10. The terminal device according to any of claims 7-9, wherein the usage scenario information comprises at least: the screen-off time of the terminal equipment;
the information obtaining unit is configured to periodically obtain one or more pieces of information of the application indication information of the first application and the usage scenario information of the terminal device after the terminal device enters the screen-off state.
11. The terminal device according to any of claims 7-10, wherein the analyzing unit is further configured to determine a first heartbeat time, where the first heartbeat time is a time of expiration of a first duration from a current time, and the first duration is equal to a heartbeat cycle of the first application;
the terminal device further includes: and the application awakening unit is used for awakening the first application periodically from the first heartbeat time according to the heartbeat cycle of the first application so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application until the client of the first application disconnects the long connection or the terminal device is switched from the screen-off state to the screen-on state.
12. The terminal device according to any of claims 7-10, wherein the analyzing unit is further configured to determine a first heartbeat time, where the first heartbeat time is a time of expiration of a first duration from a current time, and the first duration is equal to a heartbeat cycle of the first application;
the terminal device further includes: the application awakening unit is used for awakening the first application at a system heartbeat time closest to the first heartbeat time after the current time so as to trigger the client of the first application to send a heartbeat packet to the application server of the first application;
after the analysis unit determines a first heartbeat time, the analysis unit and the application wakeup unit are further configured to cyclically execute the following steps (1) and (2) until the client of the first application disconnects the long connection or the terminal device changes from the screen-off state to the screen-on state:
step (1): the analysis unit determines the next heartbeat time according to the heartbeat cycle of the first application;
step (2): the application awakening unit awakens the first application at a system heartbeat time closest to the next heartbeat time so as to trigger a client of the first application to send a heartbeat packet to an application server of the first application; and the system heartbeat time is determined by the terminal equipment according to a system heartbeat clock started when the terminal equipment is started.
13. A terminal device, characterized in that the terminal device comprises:
a memory for storing one or more computer programs;
a radio frequency circuit for transmitting and receiving a radio signal;
a processor for executing one or more computer programs stored by the memory to cause the terminal device to implement the heartbeat wakeup method of the application of any one of claims 1-6.
14. A computer-readable storage medium having computer-executable instructions stored thereon, which, when executed, implement a heartbeat wakeup method for an application as claimed in any one of claims 1 to 6.
15. A chip system, comprising:
a storage medium to store instructions;
processing circuitry to execute the instructions to implement a heartbeat wakeup method for an application as claimed in any one of claims 1 to 6.
16. A computer program product, characterized in that it comprises program instructions to implement a heartbeat wake-up method for an application as claimed in any one of claims 1 to 6 when run on a computer.
CN201910867228.3A 2019-09-12 2019-09-12 Heartbeat awakening method for application and terminal equipment Pending CN110753086A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910867228.3A CN110753086A (en) 2019-09-12 2019-09-12 Heartbeat awakening method for application and terminal equipment
PCT/CN2020/114596 WO2021047611A1 (en) 2019-09-12 2020-09-10 Heartbeat-based application wakeup method, and terminal apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910867228.3A CN110753086A (en) 2019-09-12 2019-09-12 Heartbeat awakening method for application and terminal equipment

Publications (1)

Publication Number Publication Date
CN110753086A true CN110753086A (en) 2020-02-04

Family

ID=69276402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910867228.3A Pending CN110753086A (en) 2019-09-12 2019-09-12 Heartbeat awakening method for application and terminal equipment

Country Status (2)

Country Link
CN (1) CN110753086A (en)
WO (1) WO2021047611A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021047611A1 (en) * 2019-09-12 2021-03-18 华为技术有限公司 Heartbeat-based application wakeup method, and terminal apparatus
CN112532264A (en) * 2020-11-27 2021-03-19 石家庄市善理通益科技有限公司 Power consumption optimization method of talkback terminal and execution device thereof
CN113691930A (en) * 2020-05-19 2021-11-23 京东方科技集团股份有限公司 Mobile terminal, control method thereof, internet of things system and storage medium
CN114338389A (en) * 2021-12-28 2022-04-12 中国联合网络通信集团有限公司 Heartbeat packet sending method and device, electronic equipment and storage medium
CN114390072A (en) * 2021-12-17 2022-04-22 武汉慧联无限科技有限公司 Information processing method, device and storage medium
WO2022127785A1 (en) * 2020-12-16 2022-06-23 华为技术有限公司 Heartbeat synchronization method, electronic device, and system
WO2023051195A1 (en) * 2021-09-28 2023-04-06 华为技术有限公司 Communication method and communication apparatus
CN117135729A (en) * 2023-01-20 2023-11-28 荣耀终端有限公司 Multi-device cooperation method, system and terminal device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103561179A (en) * 2013-10-31 2014-02-05 宇龙计算机通信科技(深圳)有限公司 Method and device for adjusting waking time of intelligent terminal
CN104412649A (en) * 2014-06-18 2015-03-11 华为技术有限公司 Heartbeat adjusting method, device and terminal
CN107517136A (en) * 2016-06-16 2017-12-26 中兴通讯股份有限公司 The implementation method of heartbeat keep-alive, apparatus and system
CN107645529A (en) * 2016-07-21 2018-01-30 腾讯科技(深圳)有限公司 Heartbeat packet transmission method and device
CN108768763A (en) * 2018-05-04 2018-11-06 北京小米移动软件有限公司 Heartbeat message sending method and device
WO2018223592A1 (en) * 2017-06-09 2018-12-13 深圳市沃特沃德股份有限公司 Method, apparatus, and terminal device for maintaining heartbeat connection
CN109660584A (en) * 2017-10-12 2019-04-19 阿里巴巴集团控股有限公司 A kind of method and communication means and communication system of client and the long connection of server foundation

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012060995A2 (en) * 2010-11-01 2012-05-10 Michael Luna Distributed caching in a wireless network of content delivered for a mobile application over a long-held request
US8326985B2 (en) * 2010-11-01 2012-12-04 Seven Networks, Inc. Distributed management of keep-alive message signaling for mobile network resource conservation and optimization
EP3008943A4 (en) * 2013-06-11 2017-02-22 Seven Networks, LLC Optimizing keepalive and other background traffic in a wireless network
CN105893129B (en) * 2016-03-30 2020-01-07 北京小米移动软件有限公司 Method and device for processing application program in terminal
CN106341908A (en) * 2016-08-24 2017-01-18 福州瑞芯微电子股份有限公司 Method and system for maintaining long connection of mobile network
CN110753086A (en) * 2019-09-12 2020-02-04 华为技术有限公司 Heartbeat awakening method for application and terminal equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103561179A (en) * 2013-10-31 2014-02-05 宇龙计算机通信科技(深圳)有限公司 Method and device for adjusting waking time of intelligent terminal
CN104412649A (en) * 2014-06-18 2015-03-11 华为技术有限公司 Heartbeat adjusting method, device and terminal
CN107517136A (en) * 2016-06-16 2017-12-26 中兴通讯股份有限公司 The implementation method of heartbeat keep-alive, apparatus and system
CN107645529A (en) * 2016-07-21 2018-01-30 腾讯科技(深圳)有限公司 Heartbeat packet transmission method and device
WO2018223592A1 (en) * 2017-06-09 2018-12-13 深圳市沃特沃德股份有限公司 Method, apparatus, and terminal device for maintaining heartbeat connection
CN109660584A (en) * 2017-10-12 2019-04-19 阿里巴巴集团控股有限公司 A kind of method and communication means and communication system of client and the long connection of server foundation
CN108768763A (en) * 2018-05-04 2018-11-06 北京小米移动软件有限公司 Heartbeat message sending method and device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021047611A1 (en) * 2019-09-12 2021-03-18 华为技术有限公司 Heartbeat-based application wakeup method, and terminal apparatus
CN113691930A (en) * 2020-05-19 2021-11-23 京东方科技集团股份有限公司 Mobile terminal, control method thereof, internet of things system and storage medium
CN113691930B (en) * 2020-05-19 2023-08-22 京东方科技集团股份有限公司 Mobile terminal, control method thereof, internet of things system and storage medium
CN112532264A (en) * 2020-11-27 2021-03-19 石家庄市善理通益科技有限公司 Power consumption optimization method of talkback terminal and execution device thereof
WO2022127785A1 (en) * 2020-12-16 2022-06-23 华为技术有限公司 Heartbeat synchronization method, electronic device, and system
WO2023051195A1 (en) * 2021-09-28 2023-04-06 华为技术有限公司 Communication method and communication apparatus
CN114390072A (en) * 2021-12-17 2022-04-22 武汉慧联无限科技有限公司 Information processing method, device and storage medium
CN114390072B (en) * 2021-12-17 2023-09-29 武汉慧联无限科技有限公司 Information processing method, device and storage medium
CN114338389A (en) * 2021-12-28 2022-04-12 中国联合网络通信集团有限公司 Heartbeat packet sending method and device, electronic equipment and storage medium
CN114338389B (en) * 2021-12-28 2023-05-30 中国联合网络通信集团有限公司 Heartbeat packet sending method and device, electronic equipment and storage medium
CN117135729A (en) * 2023-01-20 2023-11-28 荣耀终端有限公司 Multi-device cooperation method, system and terminal device

Also Published As

Publication number Publication date
WO2021047611A1 (en) 2021-03-18

Similar Documents

Publication Publication Date Title
CN110753086A (en) Heartbeat awakening method for application and terminal equipment
US10057673B2 (en) Electronic device and operating method thereof
US9867152B2 (en) Method and device for measuring amount of user physical activity
KR102209523B1 (en) Electronic apparatus and positiong method thereof
WO2016054773A1 (en) Target device positioning method, and mobile terminal
KR20180005471A (en) Method and apparatus for communicating using multi frequency bands
AU2017435235B2 (en) Application management method and terminal
CN111983559A (en) Indoor positioning navigation method and device
CN110727381A (en) Application switching method and electronic equipment
CN112637758B (en) Equipment positioning method and related equipment thereof
CN112134995A (en) Method, terminal and computer readable storage medium for searching application object
CN110944307A (en) Data transmission method, terminal, server, device and storage medium
US20220231792A1 (en) Data transmission method and apparatus, storage medium, and device
EP2996316B1 (en) Methods and systems for communication management between an electronic device and a wearable electronic device
CN111125436A (en) Data management method, device and system
TW201606566A (en) A terminal and a method of controlling the same
WO2019191996A1 (en) Data transmission method and device
CN111459410B (en) Memory space allocation method and device, electronic equipment and storage medium
CN112181915B (en) Method, device, terminal and storage medium for executing service
CN114785766B (en) Control method, terminal and server of intelligent equipment
KR102031599B1 (en) Multimedia information presentation method and terminal
US20200167016A1 (en) Electronic device and method of transmitting data by electronic device
CN113923769A (en) Positioning method and device
CN111510553A (en) Motion trail display method and device and readable storage medium
CN114384465A (en) Azimuth angle determination method and 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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200204

WD01 Invention patent application deemed withdrawn after publication