CN108390910B - Power saving method and device for pushing SDK and computer readable medium - Google Patents

Power saving method and device for pushing SDK and computer readable medium Download PDF

Info

Publication number
CN108390910B
CN108390910B CN201810043504.XA CN201810043504A CN108390910B CN 108390910 B CN108390910 B CN 108390910B CN 201810043504 A CN201810043504 A CN 201810043504A CN 108390910 B CN108390910 B CN 108390910B
Authority
CN
China
Prior art keywords
mobile terminal
tcp connection
server
sdk
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810043504.XA
Other languages
Chinese (zh)
Other versions
CN108390910A (en
Inventor
刘铎涛
吴亚海
王可为
唐献
罗伟东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jipusi Information Consulting Shenzhen Co ltd
Original Assignee
Jipusi Information Consulting Shenzhen Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jipusi Information Consulting Shenzhen Co ltd filed Critical Jipusi Information Consulting Shenzhen Co ltd
Priority to CN201810043504.XA priority Critical patent/CN108390910B/en
Publication of CN108390910A publication Critical patent/CN108390910A/en
Application granted granted Critical
Publication of CN108390910B publication Critical patent/CN108390910B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network-specific arrangements or communication protocols supporting networked applications
    • H04L67/14Network-specific arrangements or communication protocols supporting networked applications for session management
    • H04L67/143Network-specific arrangements or communication protocols supporting networked applications for session management provided for session termination, e.g., event controlled end of session
    • H04L67/145Network-specific arrangements or communication protocols supporting networked applications for session management provided for session termination, e.g., event controlled end of session provided for avoiding end of session, e.g. keep-alive, heartbeats, resumption message, wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0251Power saving arrangements in terminal devices using monitoring of local events, e.g. events related to user activity
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention discloses a power-saving method, a device and a computer readable medium for pushing SDK, wherein the method comprises the steps that a mobile terminal starts the pushing SDK service and is in TCP connection with a server; the mobile terminal monitors network changes in a mobile terminal system; the method comprises the steps that the mobile terminal monitors the running state of an application program on the mobile terminal; the mobile terminal judges whether the TCP connection is effective or not according to the network change and the running state; when the TCP connection is effective, the mobile terminal confirms the maximum heartbeat packet interval time and sends a heartbeat packet to the server through a self-adaptive algorithm dynamically adjusted by a network; the effect is as follows: whether the TCP connection is effective or not is judged by monitoring the network change of a terminal system and the running state of an application program, and the periodic detection consumption is reduced by effectively and dynamically adjusting the maximum time of the heartbeat packet interval when the TCP connection is effective, so that the power consumption is reduced.

Description

Power saving method and device for pushing SDK and computer readable medium
Technical Field
The invention relates to the technical field of mobile internet communication, in particular to a power saving method and device for pushing an SDK and a computer readable medium.
Background
Push SDK (Software Development Kit) requires establishing a TCP connection, and in order to ensure the timeliness of messages, the availability of the TCP connection needs to be maintained. Most mobile wireless Network operators eliminate corresponding items in a Network Address Translation (NAT) table when a link has no data communication for a period of time, resulting in link interruption. NAT timeout is an important factor affecting the service life of TCP connection; the NAT timeout time of each operator is not uniform, the heartbeat interval time cannot be confirmed, and the performance is influenced by too short heartbeat intervals, so that the power consumption is increased. In addition, the size of the heartbeat packet also affects the flow consumption and the power consumption.
Disclosure of Invention
In order to solve the above problems, the present invention provides a power saving method, apparatus and computer readable medium for pushing an SDK, which reduces power consumption when pushing the SDK.
In a first aspect, an embodiment of the present invention provides a power saving method for pushing an SDK, where the method includes:
the mobile terminal starts a push SDK service and is in TCP connection with the server;
the mobile terminal monitors network changes in a mobile terminal system;
the method comprises the steps that the mobile terminal monitors the running state of an application program on the mobile terminal;
the mobile terminal judges whether the TCP connection is effective or not according to the network change and the running state;
when the TCP connection is effective, the mobile terminal confirms the maximum heartbeat packet interval time and sends a heartbeat packet to the server through a self-adaptive algorithm dynamically adjusted by the network.
In a further aspect, the method further includes reducing the size of the heartbeat packet when the mobile terminal sends the heartbeat packet to the server. By using the method, the extremely small heartbeat packet is used, so that the air channel resource consumption caused by heartbeat is reduced, and part of the power consumption caused by the heartbeat is reduced.
In a further aspect, the method further includes, when the TCP connection is invalid, the mobile terminal restarting the TCP connection with the server. By the method, the availability of the TCP connection is maintained, and the timeliness of pushing the SDK is ensured.
The method comprises the following steps that the number of reconnection times for restarting the TCP connection with the server by the mobile terminal is three, the reconnection times are cleared after any connection is successful, and the connection is stopped after the reconnection times exceed three times until the TCP connection with the server is restarted by the mobile terminal after the network state is changed. By the method, the detection time of the TCP connection can be effectively controlled, and unnecessary reconnection times are reduced, so that power consumption is reduced.
In a second aspect, an embodiment of the present invention provides a power saving apparatus for pushing an SDK, including a unit for performing the first aspect, where the unit includes:
the starting module is used for starting the pushing SDK service by the mobile terminal and carrying out TCP connection with the server;
the network monitoring module is used for monitoring network changes in the mobile terminal system by the mobile terminal;
the operation monitoring module is used for monitoring the operation state of the application program on the mobile terminal by the mobile terminal;
the judging module is used for judging whether the TCP connection is effective or not by the mobile terminal according to the network change and the running state;
and the processing module is used for confirming the maximum heartbeat packet interval time and sending the heartbeat packet to the server by the mobile terminal through a network dynamically adjusted self-adaptive algorithm when the TCP connection is effective.
The system further comprises an optimization module, wherein the optimization module is used for reducing the size of the heartbeat packet when the mobile terminal sends the heartbeat packet to the server.
The system further comprises a reconnection module, wherein the reconnection module is used for restarting the TCP connection with the server when the TCP connection is invalid.
The method further comprises a limiting module, wherein the limiting module is used for setting the reconnection times of the mobile terminal for restarting the TCP connection with the server to be three times, clearing the reconnection times after any connection is successful, stopping the connection after the reconnection times exceed three times, and restarting the TCP connection with the server by the mobile terminal until the network state is changed.
In a third aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored, the computer program including program instructions, which, when executed by a processor, cause the processor to execute the method of the first aspect.
According to the scheme, the power-saving method, the device and the computer readable medium for pushing the SDK provided by the invention can judge whether the TCP connection is effective or not by monitoring the network change of a terminal system and the running state of an application program, and can reduce the periodic detection consumption so as to reduce the power consumption by effectively and dynamically adjusting the maximum time of the heartbeat packet interval when the TCP connection is effective.
Drawings
Fig. 1 is a flowchart of a power saving method for pushing an SDK according to a first embodiment of the present invention;
fig. 2 is a flowchart of a power saving method for pushing an SDK according to a second embodiment of the present invention;
fig. 3 is a schematic block diagram of a power saving device for pushing an SDK according to the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following detailed description is made with reference to the accompanying drawings and specific embodiments, and the description herein does not mean that all the subject matter corresponding to the specific examples set forth in the embodiments is cited in the claims.
Referring to fig. 1, a flowchart of a power saving method for pushing an SDK according to a first embodiment of the present invention is shown, the power saving method for pushing an SDK is applied to a mobile terminal equipped with an application, and the method includes:
s101, the mobile terminal starts a push SDK service and is in TCP connection with a server;
specifically, the mobile terminal includes a mobile phone or a tablet computer and other terminal devices, which are not limited herein, and after the terminal device is authorized, the terminal device starts the SDK push service and triggers a long TCP connection between the terminal device and the server, and the server can push the SDK service by using the long TCP connection.
S102, the mobile terminal monitors network changes in a mobile terminal system;
specifically, for example, the android system may actively inform the current network conditions of the terminal device, including a presence state, a non-presence state, and a connected wireless network or wired network condition.
S103, the mobile terminal monitors the running state of an application program on the mobile terminal;
specifically, the running states include a foreground running state, a background running state, and an exit state.
The skilled person may use any suitable technical means to determine the running state of the current application, and may restrict the start of the push service in the background running state and the exit state, which is not limited in this disclosure, and the usage period of the application is calculated according to the acquisition and analysis of the running state when the application is applied.
S104, the mobile terminal judges whether the TCP connection is effective or not according to the network change and the running state;
specifically by monitoring network changes and operating conditions. For example, when it is monitored that the running state of the application is switched to a background running state, a no-network state or a quit state, the push SDK can be killed, and long connection with the server is disconnected, so that the purposes of saving flow, electric quantity and memory are achieved; meanwhile, whether the heartbeat packet period is overtime or not can be judged by monitoring the heartbeat packet period in the long connection.
And S105, when the TCP connection is effective, the mobile terminal confirms the maximum heartbeat packet interval time through a self-adaptive algorithm dynamically adjusted by the network and sends a heartbeat packet to the server.
Specifically, the maximum heartbeat packet interval time under different networks or running states is determined by periodically sending heartbeats and a corresponding self-adaptive algorithm, after a heartbeat packet is sent to a server, a heartbeat response packet returned by the server is waited, and after the heartbeat response packet is received, the next monitoring response period is waited.
Further, in order to reduce power consumption, the method further comprises the step that when the mobile terminal sends the heartbeat packet to the server, the size of the heartbeat packet is reduced, and the extremely small heartbeat packet is used, so that air channel resource consumption caused by heartbeat is reduced, and partial power consumption caused by the heartbeat is reduced.
Please refer to fig. 2, which is a flowchart illustrating a power saving method for pushing an SDK according to a second embodiment of the present invention, wherein steps S201 to S204 shown in fig. 2 are similar to steps S101 to S104 shown in fig. 1, and are not repeated here. As shown in fig. 2, the method further includes, S205, when the TCP connection is invalid, the mobile terminal restarts the TCP connection with the server.
Specifically, the TCP connection invalidation is, in addition to the foregoing, also the TCP connection invalidation when the mobile terminal does not receive the heartbeat response packet returned by the server, and when the TCP connection invalidation is determined, the TCP connection with the server is restarted, so that the availability of the TCP connection is maintained, and the timeliness of pushing the SDK is ensured.
And S206, the mobile terminal restarts the TCP connection with the server for three times, after any connection is successful, the reconnection times are cleared, and after the reconnection times exceed three times, the connection is stopped until the TCP connection with the server is restarted by the mobile terminal after the network state is changed.
Specifically, the reconnection times can be specifically set in the application, the reconnection times are counted, as long as the reconnection times do not exceed the preset times, the counting of the reconnection times is cleared after any connection is successful, and then the connection is effectively carried out.
By the method, the heartbeat interval time can be effectively and dynamically adjusted, and a very small heartbeat packet is used, so that the air channel resource consumption caused by heartbeat is reduced, the load of a heartbeat server is reduced, and part of power consumption caused by heartbeat is reduced; meanwhile, the network change of the system and the running state of the application are monitored, the detection time of the TCP connection can be effectively controlled, and the periodic detection consumption and the reconnection times are reduced, so that the power consumption is reduced.
Referring to fig. 3, a schematic block diagram of a power saving device for pushing an SDK according to the present invention is shown, where the power saving device for pushing an SDK includes a unit for performing the power saving method, and the unit includes:
the starting module is used for starting the pushing SDK service by the mobile terminal and carrying out TCP connection with the server;
the network monitoring module is used for monitoring network changes in the mobile terminal system by the mobile terminal;
the operation monitoring module is used for monitoring the operation state of the application program on the mobile terminal by the mobile terminal;
the judging module is used for judging whether the TCP connection is effective or not by the mobile terminal according to the network change and the running state;
and the processing module is used for confirming the maximum heartbeat packet interval time and sending the heartbeat packet to the server by the mobile terminal through a network dynamically adjusted self-adaptive algorithm when the TCP connection is effective.
Further, the mobile terminal further comprises an optimization module, wherein the optimization module is used for reducing the size of the heartbeat packet when the mobile terminal sends the heartbeat packet to the server.
Further, the mobile terminal also comprises a reconnection module, and the reconnection module is used for restarting the TCP connection with the server when the TCP connection is invalid.
The system further comprises a limiting module, wherein the limiting module is used for setting the reconnection times for restarting the TCP connection with the server of the mobile terminal to be three times, clearing the reconnection times after any connection is successful, stopping the connection after the reconnection times exceed the three times, and restarting the TCP connection with the server of the mobile terminal until the network state is changed.
An embodiment of the present invention provides a computer-readable storage medium storing a computer program, the computer program comprising program instructions that, when executed by a processor, cause the processor to perform the above-mentioned method.
The Processor may be a Central Processing Unit (CPU), other general-purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, a discrete hardware component, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor being the control center of the multi-turn absolute value encoder, with various interfaces and lines connecting the various parts of the entire multi-turn absolute value encoder. The program instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Finally, while the foregoing is directed to the preferred embodiment of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.

Claims (9)

1. A power saving method for pushing an SDK is applied to a mobile terminal provided with an application program, and the method comprises the following steps:
the mobile terminal starts a push SDK service and is in TCP connection with the server;
the mobile terminal monitors network changes in a mobile terminal system;
the method comprises the steps that the mobile terminal monitors the running state of an application program on the mobile terminal;
the mobile terminal judges whether the TCP connection is effective or not according to the network change and the running state; the method specifically comprises the following steps: when the running state of the application is monitored to be switched into a background running state, a no-network state or an exit state, the push SDK can be killed, and long connection with the server is disconnected;
when the TCP connection is effective, the mobile terminal confirms the maximum heartbeat packet interval time and sends a heartbeat packet to the server through a self-adaptive algorithm dynamically adjusted by the network.
2. The power saving method for pushing the SDK according to claim 1, wherein the method further comprises reducing the size of the heartbeat packet when the mobile terminal sends the heartbeat packet to the server.
3. The power saving method for pushing the SDK as claimed in claim 1, wherein the method further comprises the step of restarting the TCP connection with the server by the mobile terminal when the TCP connection is invalid.
4. The power saving method for pushing the SDK according to claim 3, wherein the number of reconnection times for the mobile terminal to restart the TCP connection with the server is three, and the number of reconnection times is cleared after any connection is successful, and the connection is stopped after more than three times until the mobile terminal restarts the TCP connection with the server after the network status changes.
5. A power saving device for pushing SDKs, comprising means for performing the method of any of claims 1-4, the means comprising:
the starting module is used for starting the pushing SDK service by the mobile terminal and carrying out TCP connection with the server;
the network monitoring module is used for monitoring network changes in the mobile terminal system by the mobile terminal;
the operation monitoring module is used for monitoring the operation state of the application program on the mobile terminal by the mobile terminal;
the judging module is used for judging whether the TCP connection is effective or not by the mobile terminal according to the network change and the running state; when the running state of the application is monitored to be switched into a background running state, a no-network state or an exit state, the push SDK can be killed, and long connection with the server is disconnected;
and the processing module is used for confirming the maximum heartbeat packet interval time and sending the heartbeat packet to the server by the mobile terminal through a network dynamically adjusted self-adaptive algorithm when the TCP connection is effective.
6. The power saving device for pushing the SDK according to claim 5, further comprising an optimizing module, wherein the optimizing module is configured to reduce the size of the heartbeat packet when the mobile terminal sends the heartbeat packet to the server.
7. The power saving device for pushing the SDK according to claim 6, further comprising a reconnect module, wherein the reconnect module is configured to restart the TCP connection with the server when the TCP connection is invalid.
8. The power saving device for pushing an SDK according to claim 7, further comprising a limiting module, where the limiting module is configured to set a number of times of reconnection for restarting a TCP connection with the server to three, where after any connection is successful, the number of times of reconnection is cleared, and after the number of times of reconnection exceeds three, the connection is stopped until the TCP connection with the server is restarted by the mobile terminal after the network state is changed.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-4.
CN201810043504.XA 2018-01-17 2018-01-17 Power saving method and device for pushing SDK and computer readable medium Active CN108390910B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810043504.XA CN108390910B (en) 2018-01-17 2018-01-17 Power saving method and device for pushing SDK and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810043504.XA CN108390910B (en) 2018-01-17 2018-01-17 Power saving method and device for pushing SDK and computer readable medium

Publications (2)

Publication Number Publication Date
CN108390910A CN108390910A (en) 2018-08-10
CN108390910B true CN108390910B (en) 2021-03-16

Family

ID=63077125

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810043504.XA Active CN108390910B (en) 2018-01-17 2018-01-17 Power saving method and device for pushing SDK and computer readable medium

Country Status (1)

Country Link
CN (1) CN108390910B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109769214A (en) * 2018-12-26 2019-05-17 彩讯科技股份有限公司 A kind of information push method, device, terminal and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491512A (en) * 2012-06-12 2014-01-01 腾讯科技(深圳)有限公司 Implementation method and device for information pushing
CN103685241A (en) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol)
CN104703146A (en) * 2013-12-09 2015-06-10 腾讯科技(深圳)有限公司 Information push method, information push client and information push system
CN104991850A (en) * 2015-06-27 2015-10-21 广州华多网络科技有限公司 Heartbeat package control method and apparatus for application program
WO2017215614A1 (en) * 2016-06-16 2017-12-21 中兴通讯股份有限公司 Method, device and system for realising heart beat keepalive

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103518342B (en) * 2013-04-26 2016-09-28 华为技术有限公司 The sending control method of a kind of heartbeat signal and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491512A (en) * 2012-06-12 2014-01-01 腾讯科技(深圳)有限公司 Implementation method and device for information pushing
CN103685241A (en) * 2013-11-26 2014-03-26 中国科学院计算技术研究所 Adaptive heartbeat method and adaptive heartbeat system for maintaining long connection of TCP (transmission control protocol)
CN104703146A (en) * 2013-12-09 2015-06-10 腾讯科技(深圳)有限公司 Information push method, information push client and information push system
CN104991850A (en) * 2015-06-27 2015-10-21 广州华多网络科技有限公司 Heartbeat package control method and apparatus for application program
WO2017215614A1 (en) * 2016-06-16 2017-12-21 中兴通讯股份有限公司 Method, device and system for realising heart beat keepalive

Also Published As

Publication number Publication date
CN108390910A (en) 2018-08-10

Similar Documents

Publication Publication Date Title
CN106879038B (en) working state switching method and device
US9444752B2 (en) Distributed caching systems with configurable extended caching optimization
US20180054799A1 (en) Keeping The UE Awake
US20160330098A1 (en) Keep alive management
TWI517744B (en) Apparatus and method for operating m2m devices and non-transitory computer_readable medium
US9167530B2 (en) Power saving modes in wireless devices
US9271238B2 (en) Application or context aware fast dormancy
US8743763B2 (en) User device dormancy
EP2939463B1 (en) Dynamic adaptation of a traffic inactivity timer
KR101978404B1 (en) Terminal-initiated power mode switching
KR101604561B1 (en) Proxy-based push service
US7899433B2 (en) Method and apparatus for saving power by controlling listening periods in wireless telecommunication device having a plurality for power-saving modes
US9049660B2 (en) Wake pattern management
AU2005207379B2 (en) Method and apparatus optimizing receipt of call/broadcast paging messages by self-powered wireless communications devices
US9198219B2 (en) Adaptive fast dormancy controller
JP5834366B2 (en) Power saving method, apparatus and communication terminal
ES2690316T3 (en) Terminal energy saving procedure and terminal energy saving device, and network side energy saving device
KR20120123203A (en) Push service management method, apparatus thereof, and medium storing program source thereof
US8594748B2 (en) Mobile equipment autonomous quick release detection
EP1525766B1 (en) Always-on virtual private network access
JP4629773B2 (en) Method and apparatus for transferring traffic indication message in sleep mode
KR100857050B1 (en) Communication unit energy conservation apparatus and method
US9198217B2 (en) Method for maintaining connection between terminal and network server, terminal and network server
RU2686673C1 (en) Device and method of terminal control and terminal
KR101576142B1 (en) Apparatus and method for managementing power of wlan module in portable terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant