CN107948989B - Method and device for calculating networking time of mobile terminal - Google Patents

Method and device for calculating networking time of mobile terminal Download PDF

Info

Publication number
CN107948989B
CN107948989B CN201610895629.6A CN201610895629A CN107948989B CN 107948989 B CN107948989 B CN 107948989B CN 201610895629 A CN201610895629 A CN 201610895629A CN 107948989 B CN107948989 B CN 107948989B
Authority
CN
China
Prior art keywords
wifi network
mobile terminal
networking
state
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
CN201610895629.6A
Other languages
Chinese (zh)
Other versions
CN107948989A (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.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201610895629.6A priority Critical patent/CN107948989B/en
Publication of CN107948989A publication Critical patent/CN107948989A/en
Application granted granted Critical
Publication of CN107948989B publication Critical patent/CN107948989B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a method and a device for calculating the networking time of a mobile terminal, relates to the technical field of internet, and mainly aims to confirm that the mobile terminal is in a networking state in a WiFi network through a ping command, calculate the networking time according to cyclic detection and improve the calculation accuracy of the networking time. The main technical scheme of the invention is as follows: judging whether the current network connection state of the mobile terminal is a WiFi network or not; if the network is a WiFi network, judging whether the WiFi network is in a networking state by using a ping command; and circularly judging the connection state of the WiFi network according to a preset time interval, and calculating the time length of the mobile terminal in the networking state. The method is mainly used for calculating the networking time.

Description

Method and device for calculating networking time of mobile terminal
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for calculating the networking time of a mobile terminal.
Background
Wi-Fi (WIreless-Fidelity), a technology that can wirelessly connect terminals such as personal computers, hand-held devices (e.g., PADs, cellular phones), etc., to each other, is in fact a high frequency radio signal. Wireless networking is a technology that enables terminals such as personal computers, hand-held devices (e.g., PDAs, cellular phones), etc. to be wirelessly connected to each other. Wi-Fi is a brand of wireless networking technology held by the Wi-Fi Alliance (Wi-Fi Alliance). The objective is to improve interoperability between wireless network products based on the IEEE802.11 standard. The wireless network internet access can be simply understood as wireless internet access, almost all smart phones, tablet computers and notebook computers support wireless fidelity internet access, and the wireless network internet access is the most widely used wireless network transmission technology at present. In fact, the wired network signal is converted into a wireless signal, and a wireless router is used for receiving related computers, mobile phones, panels and the like supporting the technology.
At present, most applications on the mobile terminal need to be connected to a network to be able to use, and these applications generally determine the network state of the mobile terminal device by using a relevant API (Application Programming Interface) provided by the system in a circulating manner to calculate the online time, and calculate the time when the device is in the networking state. However, when the method for calculating the time length is in a WiFi network state, the online time length cannot be accurately counted. For example, when a wireless router is not networked but provides a WiFi network environment, the system of mobile terminal devices connected in the WiFi network will determine that the mobile terminal devices are in a networked state, but the applications in the devices cannot access the network. Therefore, the mobile terminal device can make misjudgment on the network state, and errors are generated in the calculation of the networking time.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for calculating a networking duration of a mobile terminal, and mainly aims to confirm that the mobile terminal is in a networking state in a WiFi network through a ping command, calculate the networking duration according to cyclic detection, and improve the accuracy of calculating the networking duration.
In order to achieve the purpose, the invention mainly provides the following technical scheme:
in one aspect, the present invention provides a method for calculating a networking duration of a mobile terminal, including:
judging whether the current network connection state of the mobile terminal is a WiFi network or not;
if the network is a WiFi network, judging whether the WiFi network is in a networking state by using a ping command;
and circularly judging the connection state of the WiFi network according to a preset time interval, and calculating the time length of the mobile terminal in the networking state.
Preferably, the determining whether the WiFi network is in a networking state by using a ping command includes:
sending a data packet to a target IP address by using a ping command;
and determining whether the WiFi network is in a networking state according to the return value of the ping command.
Preferably, the determining whether the WiFi network is in a networking state according to the return value of the ping command includes:
acquiring a preset threshold value, wherein the preset threshold value is used for measuring a normal value of the WiFi network in a networking state;
and comparing the return value with the preset threshold value to determine whether the WiFi network is in a networking state.
Preferably, the circularly judging the connection state of the WiFi network according to the preset time interval, and calculating the duration of the mobile terminal in the networking state includes:
acquiring the duration of the preset time interval;
counting the times of circularly judging the connection state of the WiFi network that the judgment result is in the networking state;
and calculating the time length of the mobile terminal in the networking state according to the time length and the times.
Preferably, before determining whether the current network connection state of the mobile terminal is the WiFi network, the method further includes:
and acquiring the current network connection state of the mobile terminal by using an application programming interface provided by a system, wherein the network connection state comprises a mobile network and a WiFi network.
On the other hand, the invention also provides a device for calculating the networking time length of the mobile terminal, which comprises the following components:
the first judging unit is used for judging whether the current network connection state of the mobile terminal is a WiFi network or not;
the second judging unit is used for judging whether the WiFi network is in a networking state or not by utilizing a ping command when the first judging unit judges that the mobile terminal is in the WiFi network;
and the calculating unit is used for circularly judging the connection state of the WiFi network according to a preset time interval and calculating the duration of the mobile terminal in the networking state.
Preferably, the second determination unit includes:
the sending module is used for sending a data packet to the target IP address by utilizing a ping command;
and the determining module is used for determining whether the WiFi network is in a networking state according to the return value of the ping command.
Preferably, the determining module includes:
the obtaining submodule is used for obtaining a preset threshold value, and the preset threshold value is used for measuring a normal value of the WiFi network in a networking state;
and the determining submodule is used for comparing the return value with the preset threshold value obtained by the obtaining submodule so as to determine whether the WiFi network is in a networking state.
Preferably, the calculation unit includes:
the acquisition module is used for acquiring the duration of the preset time interval;
the statistical module is used for counting the times of circularly judging the number of times that the judgment result in the connection state of the WiFi network is in the networking state;
and the calculating module is used for calculating the time length of the mobile terminal in the networking state according to the time length obtained by the obtaining module and the times obtained by the counting module.
Preferably, the apparatus further comprises:
the obtaining unit is used for obtaining the current network connection state of the mobile terminal by using an application programming interface provided by a system before the first judging unit judges whether the current network connection state of the mobile terminal is the WiFi network, wherein the network connection state comprises the mobile network and the WiFi network.
According to the method and the device for calculating the networking time of the mobile terminal, when the mobile terminal is judged to be in the WiFi network, the mobile terminal is determined to be in the networking state by using the ping command, and continuous judgment is carried out through cyclic detection, so that the network disconnection state of the mobile terminal in the WiFi network is found in time, and the networking time is excluded from the networking time. The method and the device are mainly used for detecting the networking state of the mobile terminal in the WiFi environment, so that the real online time length of the mobile terminal is calculated, and the accuracy of the networking time length statistics is improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a method for calculating a mobile terminal networking time duration according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating another method for calculating a networking duration of a mobile terminal according to an embodiment of the present invention;
FIG. 3 is a block diagram illustrating an apparatus for calculating a networking duration of a mobile terminal according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating another computing apparatus for a mobile terminal networking duration according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
The embodiment of the invention provides a method for calculating the networking time of a mobile terminal, which is applied to detecting the networking state of equipment and counting the networking time in a WiFi environment as shown in figure 1, and the following specific steps are provided for the embodiment of the invention:
101. and judging whether the current network connection state of the mobile terminal is a WiFi network.
The mobile terminal in the embodiment of the invention is a terminal device which is provided with an intelligent operating system and can be connected with various standard networks, and the terminal device comprises but is not limited to a mobile phone, a tablet computer, wearable intelligent hardware and the like. Because the intelligent system of the mobile terminal is provided with the network connection identification method, the embodiment of the invention further verifies the network connection state identified by the system, so that the mobile device can access the Internet under the WiFi network, and the mobile device cannot access the Internet only in the local WiFi network environment provided by the wireless router.
102. If the network is the WiFi network, judging whether the WiFi network is in a networking state or not by utilizing a ping command.
When the system determines that the mobile terminal is in the WiFi network, whether the WiFi network environment is in a networking state is verified through a ping command, and the networking state means that the mobile device can access the Internet through the WiFi network.
Among them, ping (Packet Internet Groper, Internet Packet explorer) is a program for testing the network connection amount. Ping sends an ICMP (Internet Control Messages protocol), namely an Internet message Control protocol; an echo request message is sent to the destination and reports whether the desired ICMP echo (ICMP echo reply) is received. It is a command to check whether the network is open or the speed of the network connection. The principle used by ping is that: the uniqueness of the IP address of the machine on the network is utilized to send a data packet to the target IP address, and then the opposite side is required to return a data packet with the same size to determine whether the two network machines are communicated or not and what the time delay is.
103. And circularly judging the connection state of the WiFi network according to a preset time interval, and calculating the duration of the mobile terminal in the networking state.
The determination method in step 102 is used to continuously determine the connection state of the WiFi network in a cyclic determination manner, and the cyclic time interval can be set by user according to the actual situation, for example, the time interval is set according to the strength of the WiFi network signal, when the strength is high, a longer time interval can be set, and when the strength is low, a shorter time interval is set.
The result of each judgment can be regarded as the WiFi network connection state of the mobile terminal in the time interval between the current judgment and the last judgment, and the total duration of the mobile terminal in the networking state in the WiFi network environment can be calculated by counting the judgment times of the networking state and the time interval corresponding to each time of the judgment result.
In combination with the foregoing implementation manner, it can be seen that in the method for calculating the networking time of the mobile terminal according to the embodiment of the present invention, when the mobile terminal is determined to be in the WiFi network, the ping command is used to determine that the mobile terminal is in the networking state, and continuous determination is performed through cyclic detection, so that the network disconnection state of the mobile terminal in the WiFi network is found in time, and thus the time of the network disconnection state is excluded from the networking time, so that the real online time of the mobile terminal is calculated, and the accuracy of the networking time statistics is improved.
In order to describe the method for calculating the networking time of the mobile terminal in more detail, the specific implementation of the method is described by taking the most commonly used android system mobile phone as an example, as shown in fig. 2, the method includes the following steps:
201. and judging whether the current network connection state of the mobile terminal is a WiFi network.
In the android system, the current network connection state of the mobile phone can be judged through the ConnectivityManager related api provided by the system, and for the mobile phone, the main network environments include a mobile network and a WiFi network. Through judgment and identification of the system, when the mobile phone is in a mobile network environment, the networking state of the mobile phone can be specifically judged through data connection in mobile phone setting, the data connection setting can be set to be a connected or disconnected state through manual operation of a mobile phone user, and when the mobile phone is in the connected state, the current networking state of the mobile phone can be judged. When the mobile phone is in the WiFi network environment, in order to detect that the WiFi network is an available network, and thus calculate the online time, the operation of step 202 needs to be performed.
202. And sending a data packet to the target IP address by using a ping command.
The execution principle and function of the ping command are described in the above embodiments, and are not described herein again. For the target IP address, in the embodiment of the present invention, an IP address with stable connection capability is mainly selected, that is, connectivity is stable, and connectivity detection in the embodiment of the present invention is not affected by the IP address being inaccessible. In practical applications, the target IP address generally selects a large public website, such as an IP address of hundredths or new waves. It should be noted that the server corresponding to the selected target IP address should allow the ping command operation.
203. And determining whether the WiFi network is in a networking state according to the return value of the ping command.
Because ping is a test method for sending a test data packet to a website, and checking whether the website has a response or not and counting the response time. Therefore, whether the mobile phone is in the networking state or not is judged, whether the target IP address has a response or not is judged, whether the response time is provided is judged, and when the response time is too long, the mobile phone is also judged to be in the non-networking state.
Therefore, the embodiment of the invention sets a threshold value aiming at the response time, the threshold value is used for measuring whether the response time is a normal value of the networking state, the threshold value is an empirical value, and the threshold value can be set by self according to the actual situation. After receiving a return value of the ping command, the return value comprises whether the target IP address responds and a data value of response time, whether the target IP address responds is judged firstly, after the target IP address responds is judged, a set threshold value is obtained, the threshold value is compared with the response time in the return value, and if the response time is smaller than the threshold value, the current WiFi network of the mobile phone is judged to be in a networking state.
204. And circularly judging the connection state of the WiFi network according to a preset time interval, and calculating the duration of the mobile terminal in the networking state.
When the mobile phone just accesses the WiFi network, the connection status of the WiFi network is determined, and in order to determine whether the mobile phone can continuously perform the internet access operation in the WiFi network, that is, to determine that the WiFi network is not disconnected during the mobile phone access process, the connection status of the WiFi network needs to be continuously determined, where the determination manner is the determination content in the steps 202 and 203. For the continuous judgment, a certain pressure may be applied to the processing resources of the mobile phone, and particularly, when the mobile phone is operated under a heavy load, the continuous judgment may be changed into a cyclic judgment according to a certain time interval. The time interval can be specifically set according to actual conditions.
When the time length of the mobile phone in the networking state is calculated, the time length may be accumulated according to the judgment result of step 203, specifically: when the judgment result is in the networking state, the duration of the judgment until the last judgment is accumulated into the total duration of the networking state, namely the duration of a time interval is accumulated on the total duration. In addition, when the mobile phone is in the WiFi network environment, the number of times that the judgment result in the connection state of the WiFi network is in the networking state is counted and circularly judged, and then the duration of the preset time interval is multiplied, so that the duration of the networking state of the mobile phone in the period of time can be obtained.
The following gives an implementation method based on the above embodiment, and gives a programming code for determining whether the network is in a connected state:
Figure BDA0001130281680000071
Figure BDA0001130281680000081
further, as an implementation of the foregoing method, an embodiment of the present invention provides a device for calculating a networking time duration of a mobile terminal, where the device embodiment corresponds to the foregoing method embodiment, and for convenience of reading, details in the foregoing method embodiment are not repeated in this device embodiment one by one, but it should be clear that the device in this embodiment can correspondingly implement all the contents in the foregoing method embodiment. The device is used for judging whether the mobile terminal is in a networking state in a WiFi network environment or not, and sequentially calculating the online time of the mobile phone, and specifically as shown in FIG. 3, the device comprises:
a first judging unit 31, configured to judge whether a current network connection state of the mobile terminal is a WiFi network;
a second judging unit 32, configured to judge whether the WiFi network is in a networking state by using a ping command when the first judging unit 31 judges that the mobile terminal is in the WiFi network;
and the calculating unit 33 is configured to circularly judge, according to a preset time interval, the connection state of the WiFi network judged by the second judging unit 32, and calculate a duration of the mobile terminal in the networking state.
Further, as shown in fig. 4, the second judging unit 32 includes:
a sending module 321, configured to send a data packet to a target IP address by using a ping command;
a determining module 322, configured to determine whether the WiFi network is in a networking state according to the return value of the ping command.
Further, as shown in fig. 4, the determining module 322 includes:
the obtaining sub-module 3221 is configured to obtain a preset threshold, where the preset threshold is used to measure a normal value of the WiFi network in a networking state;
the determining sub-module 3222 is configured to compare the return value with a preset threshold obtained by the obtaining sub-module 3221, so as to determine whether the WiFi network is in a networking state.
Further, as shown in fig. 4, the calculating unit 33 includes:
an obtaining module 331, configured to obtain a duration of the preset time interval;
a counting module 332, configured to count the number of times that the determination result in the connection state of the WiFi network is in the networking state in a cyclic determination manner;
a calculating module 333, configured to calculate a duration of the mobile terminal in the networking state according to the duration obtained by the obtaining module 331 and the number of times obtained by the counting module 332.
Further, the apparatus further comprises:
an obtaining unit 34, configured to obtain a current network connection state of the mobile terminal by using an application programming interface provided by a system before the first determining unit 31 determines whether the current network connection state of the mobile terminal is a WiFi network, where the network connection state includes a mobile network and a WiFi network.
In summary, the method and the device for calculating the networking time of the mobile terminal according to the embodiments of the present invention determine that the mobile terminal is in the networking state by using the ping command when the mobile terminal is determined to be in the WiFi network, and continuously determine the networking state by cyclic detection, so as to find the network disconnection state of the mobile terminal in the WiFi network in time, and thus exclude the time of the network disconnection state from the networking time, and further calculate the real online time of the mobile terminal, so as to improve the accuracy of the statistics of the networking time.
The device for calculating the networking time of the mobile terminal comprises a processor and a memory, wherein the first judging unit, the second judging unit, the calculating unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, the mobile terminal is confirmed to be in a networking state in the WiFi network through a ping command by adjusting the kernel parameters, the networking time length is calculated according to the cycle detection, and the calculation accuracy of the networking time length is improved.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device: judging whether the current network connection state of the mobile terminal is a WiFi network or not; if the network is a WiFi network, judging whether the WiFi network is in a networking state by using a ping command; and circularly judging the connection state of the WiFi network according to a preset time interval, and calculating the time length of the mobile terminal in the networking state.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for calculating the networking time of a mobile terminal is characterized by comprising the following steps:
judging whether the current network connection state of the mobile terminal is a WiFi network or not;
if the network is a WiFi network, judging whether the WiFi network is in a networking state by using a ping command;
circularly judging the connection state of the WiFi network according to a preset time interval, and calculating the duration of the mobile terminal in the networking state;
wherein, the circularly judging the connection state of the WiFi network according to the preset time interval and the calculating the duration of the mobile terminal in the networking state comprises: acquiring the duration of the preset time interval; counting the times of circularly judging the connection state of the WiFi network that the judgment result is in the networking state; and calculating the time length of the mobile terminal in the networking state according to the time length and the times.
2. The method of claim 1, wherein determining whether the WiFi network is in a networking state using a ping command comprises:
sending a data packet to a target IP address by using a ping command;
and determining whether the WiFi network is in a networking state according to the return value of the ping command.
3. The method of claim 2, wherein determining whether the WiFi network is in a networking state according to the return value of the ping command comprises:
acquiring a preset threshold value, wherein the preset threshold value is used for measuring a normal value of the WiFi network in a networking state;
and comparing the return value with the preset threshold value to determine whether the WiFi network is in a networking state.
4. The method of claim 1, wherein before determining whether the current network connection status of the mobile terminal is a WiFi network, the method further comprises:
and acquiring the current network connection state of the mobile terminal by using an application programming interface provided by a system, wherein the network connection state comprises a mobile network and a WiFi network.
5. An apparatus for calculating a networking duration of a mobile terminal, the apparatus comprising:
the first judging unit is used for judging whether the current network connection state of the mobile terminal is a WiFi network or not;
the second judging unit is used for judging whether the WiFi network is in a networking state or not by utilizing a ping command when the first judging unit judges that the mobile terminal is in the WiFi network;
the computing unit is used for circularly judging the connection state of the WiFi network according to a preset time interval and computing the duration of the mobile terminal in the networking state;
wherein the calculation unit includes:
the acquisition module is used for acquiring the duration of the preset time interval;
the statistical module is used for counting the times of circularly judging the number of times that the judgment result in the connection state of the WiFi network is in the networking state;
and the calculating module is used for calculating the time length of the mobile terminal in the networking state according to the time length obtained by the obtaining module and the times obtained by the counting module.
6. The apparatus according to claim 5, wherein the second determining unit comprises:
the sending module is used for sending a data packet to the target IP address by utilizing a ping command;
and the determining module is used for determining whether the WiFi network is in a networking state according to the return value of the ping command.
7. The apparatus of claim 6, wherein the determining module comprises:
the obtaining submodule is used for obtaining a preset threshold value, and the preset threshold value is used for measuring a normal value of the WiFi network in a networking state;
and the determining submodule is used for comparing the return value with the preset threshold value obtained by the obtaining submodule so as to determine whether the WiFi network is in a networking state.
8. The apparatus of claim 5, further comprising:
the obtaining unit is used for obtaining the current network connection state of the mobile terminal by using an application programming interface provided by a system before the first judging unit judges whether the current network connection state of the mobile terminal is the WiFi network, wherein the network connection state comprises the mobile network and the WiFi network.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, the device where the storage medium is located is controlled to execute the method for calculating the networking time of the mobile terminal according to any one of claims 1 to 4.
10. A processor, characterized in that the processor is configured to execute a program, wherein the program executes the method for calculating the networking time of the mobile terminal according to any one of claims 1 to 4.
CN201610895629.6A 2016-10-13 2016-10-13 Method and device for calculating networking time of mobile terminal Active CN107948989B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610895629.6A CN107948989B (en) 2016-10-13 2016-10-13 Method and device for calculating networking time of mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610895629.6A CN107948989B (en) 2016-10-13 2016-10-13 Method and device for calculating networking time of mobile terminal

Publications (2)

Publication Number Publication Date
CN107948989A CN107948989A (en) 2018-04-20
CN107948989B true CN107948989B (en) 2021-02-12

Family

ID=61928511

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610895629.6A Active CN107948989B (en) 2016-10-13 2016-10-13 Method and device for calculating networking time of mobile terminal

Country Status (1)

Country Link
CN (1) CN107948989B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153713B (en) * 2020-10-23 2021-08-20 珠海格力电器股份有限公司 Obstacle determination method and apparatus, storage medium, and electronic apparatus
CN113316184B (en) * 2021-05-21 2022-09-02 Tcl通讯(宁波)有限公司 5G network injection time statistical processing method and device, display equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101212364A (en) * 2006-12-30 2008-07-02 技嘉科技股份有限公司 Method and system for detecting online state of host computer
CN102177681A (en) * 2011-04-21 2011-09-07 华为技术有限公司 Fault detection method and system
CN102546619A (en) * 2011-12-29 2012-07-04 浙江工业大学 Modbus protocol conversion system based on 3G (The 3rd Generation Telecommunication) Internet access
CN104955067A (en) * 2015-05-18 2015-09-30 上海斐讯数据通信技术有限公司 Wireless Internet access information recording method and system
CN105188047A (en) * 2015-08-26 2015-12-23 广东欧珀移动通信有限公司 Wifi wireless roaming Internet access method and mobile terminal
CN105450425A (en) * 2015-12-25 2016-03-30 北京奇虎科技有限公司 Method and device for realizing internet access control of user
CN105517078A (en) * 2015-11-20 2016-04-20 小米科技有限责任公司 Network connection switching method and device
CN105611558A (en) * 2016-01-26 2016-05-25 杭州德澜科技有限公司 Equipment for performing ping packet test of WIFI module of IOT
CN105847297A (en) * 2016-05-24 2016-08-10 中国联合网络通信集团有限公司 Prompting method and system for de-binding of mobile interment application account and mobile phone number
CN105897437A (en) * 2016-04-12 2016-08-24 上海斐讯数据通信技术有限公司 Portal authentication page network tariff index synchronization method, synchronization device and synchronization system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1225866C (en) * 2002-11-19 2005-11-02 华为技术有限公司 A method for detecting whether or not WEB authentication user is on line
CN1285198C (en) * 2003-06-14 2006-11-15 华为技术有限公司 Method for detecting and controlling user access by using Internet control protocol
CN100563214C (en) * 2007-09-01 2009-11-25 腾讯科技(深圳)有限公司 A kind of method and system that improve accesses network resource speed
CN102736970A (en) * 2012-06-29 2012-10-17 浪潮电子信息产业股份有限公司 Method for monitoring activity state of operating system
CN102781017B (en) * 2012-07-03 2015-10-14 小米科技有限责任公司 A kind of method, device and communication equipment detecting Correspondent Node presence

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101212364A (en) * 2006-12-30 2008-07-02 技嘉科技股份有限公司 Method and system for detecting online state of host computer
CN102177681A (en) * 2011-04-21 2011-09-07 华为技术有限公司 Fault detection method and system
CN102546619A (en) * 2011-12-29 2012-07-04 浙江工业大学 Modbus protocol conversion system based on 3G (The 3rd Generation Telecommunication) Internet access
CN104955067A (en) * 2015-05-18 2015-09-30 上海斐讯数据通信技术有限公司 Wireless Internet access information recording method and system
CN105188047A (en) * 2015-08-26 2015-12-23 广东欧珀移动通信有限公司 Wifi wireless roaming Internet access method and mobile terminal
CN105517078A (en) * 2015-11-20 2016-04-20 小米科技有限责任公司 Network connection switching method and device
CN105450425A (en) * 2015-12-25 2016-03-30 北京奇虎科技有限公司 Method and device for realizing internet access control of user
CN105611558A (en) * 2016-01-26 2016-05-25 杭州德澜科技有限公司 Equipment for performing ping packet test of WIFI module of IOT
CN105897437A (en) * 2016-04-12 2016-08-24 上海斐讯数据通信技术有限公司 Portal authentication page network tariff index synchronization method, synchronization device and synchronization system
CN105847297A (en) * 2016-05-24 2016-08-10 中国联合网络通信集团有限公司 Prompting method and system for de-binding of mobile interment application account and mobile phone number

Also Published As

Publication number Publication date
CN107948989A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN108075934B (en) Network quality monitoring method, device and system
WO2017113527A1 (en) Method and device for switching virtual sim card, and terminal
CN110572859B (en) AP switching method, device, equipment and medium
CN109560976B (en) Message delay monitoring method and device
CN106878108B (en) Network flow playback test method and device
CN109302423B (en) Vulnerability scanning capability testing method and device
CN111263377B (en) Network configuration method, device, equipment and system and distribution network testing method and system
CN107948989B (en) Method and device for calculating networking time of mobile terminal
CN104954431A (en) Network selection method, device and system
CN111431772A (en) Network delay measuring method, system, readable storage medium and terminal equipment
CN109451518B (en) Method and equipment for distinguishing WLAN access mode of terminal
WO2019015040A1 (en) Signal strength based frequency point selection method and internet of things terminal
CN109189677B (en) Test method and device for updating state of variable value
CN104978212A (en) Unknown crash reporting method and unknown crash reporting device
CN107438268B (en) Method and device for accelerating wireless network for mobile device
CN109951549B (en) Network page access method and device and computer readable storage medium
CN111190801A (en) Recommendation system testing method and device and electronic equipment
CN108076450B (en) Method and device for identifying same user
JP6382530B2 (en) Communication terminal and program
CN114218011A (en) Test simulation method and device, terminal equipment and storage medium
CN110572299B (en) Equipment testing method, system, device, network node, terminal and storage medium
JP2022546792A (en) Access point name setting method, device and readable storage medium
US10171970B2 (en) Resource notification method and system, local CSE, remote CSE and storage medium
CN105515896B (en) A kind of judgment method and device of mobile terminal network obstruction
KR20180008088A (en) Apparatus and method for performance test of IED and computer readable recording medium to member deterioration

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant