CN113709086B - Network detection method, device, electronic equipment and storage medium - Google Patents
Network detection method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113709086B CN113709086B CN202010441027.XA CN202010441027A CN113709086B CN 113709086 B CN113709086 B CN 113709086B CN 202010441027 A CN202010441027 A CN 202010441027A CN 113709086 B CN113709086 B CN 113709086B
- Authority
- CN
- China
- Prior art keywords
- network
- state
- address
- preset
- detection
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/10—Network architectures or network communication protocols for network security for controlling access to devices or network resources
- H04L63/107—Network architectures or network communication protocols for network security for controlling access to devices or network resources wherein the security policies are location-dependent, e.g. entities privileges depend on current location or allowing specific operations only from locally connected terminals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Telephone Function (AREA)
Abstract
The present disclosure relates to the field of mobile terminals, and in particular, to a network detection method, a device, an electronic apparatus, and a storage medium. The method in one embodiment comprises: acquiring a real-time geographic position of a terminal, and acquiring a network state detection address set when the real-time geographic position is within a preset range; respectively sending a detection request according to the addresses in the network state detection address set to obtain a state code; when the preset state code exists in the state codes, the terminal is judged to be in a network connection state. Therefore, in the area where the terminal cannot access the network due to the network detection mechanism limited by the android native, network communication can be realized by detecting the addresses in the address set through the network state.
Description
Technical Field
The present disclosure relates to the field of network technologies, and in particular, to a network detection method, device, electronic apparatus, and storage medium.
Background
With the development of science and technology, mobile terminals such as smart phones and tablets are widely applied to the production and life of people. The user can access the network through the terminal equipment, thereby acquiring various information or learning various skills and the like, which are greatly convenient for the production and life of people.
The terminal equipment can be accessed to the network through the user card, and also can be accessed to the wireless network with certain places open. For example, in a wireless network coverage area, a user may access the wireless network by means of web page login authentication on a terminal device. And is limited by the android native network detection mechanism, which results in that the terminal equipment cannot access the network in certain areas.
Disclosure of Invention
Based on this, it is necessary to provide a network detection method, device, electronic device and storage medium for solving the technical problem that the existing terminal device cannot access the network through the web page login authentication in some areas.
A network detection method, the method comprising:
acquiring a real-time geographic position of a terminal;
when the real-time geographic position is within a preset range, acquiring a network state detection address set;
sending detection requests according to the addresses in the network state detection address set respectively to obtain a state code;
and when the preset state code exists in the state codes, judging that the terminal is in a network communication state.
In one embodiment, when the preset status code exists in the status codes, determining that the terminal is in the network connection state includes:
when a preset first state code exists in the state codes, judging that the terminal is in a network direct communication state;
and when the preset first state code does not exist in the state codes and the preset second state code exists in the state codes, judging that the terminal is in a network address transfer communication state.
In one embodiment, when the preset first status code is not present in the status codes and the preset second status code is present, the method further includes, after determining that the terminal is in the network address transfer connected state:
and obtaining a address transfer address corresponding to the preset second state code, and displaying a webpage login authentication page through the address transfer address.
In one embodiment, the method further comprises:
when the webpage login authentication page is updated, a target address in a network state detection address set corresponding to the preset second state code is obtained, and network direct connection detection is carried out through the target address;
and when detecting that the network direct connection fails, performing network direct connection detection through the standby address in the network state detection address set so as to enable the terminal to access the network.
In one embodiment, when the first status code does not exist in the status codes and the preset second status code exists, the method further includes, after determining that the terminal is in the network address transfer connected state:
acquiring a transfer address corresponding to the preset second state code, and waking up a corresponding application program when the transfer address contains a preset application program identifier;
and displaying a login authentication page based on the awakened application program.
In one embodiment, the method further comprises:
and when the address transfer address does not contain the preset application program identifier, starting a program downloading function of the application program corresponding to the application program identifier.
In one embodiment, the acquiring the real-time geographic location of the terminal includes:
acquiring longitude and latitude coordinates, and acquiring a real-time geographic position of a terminal according to the longitude and latitude coordinates;
or alternatively, the first and second heat exchangers may be,
acquiring corresponding base station information, and acquiring the real-time geographic position of a terminal according to the base station information;
or alternatively, the first and second heat exchangers may be,
acquiring wireless network base station information, identifying a country code corresponding to the wireless network base station information, and acquiring the real-time geographic position of the terminal according to the country code.
A network detection device, the device comprising:
the real-time position acquisition module is used for acquiring the real-time geographic position of the terminal;
the detection address acquisition module is used for acquiring a network state detection address set when the real-time geographic position is within a preset range;
the detection address processing module is used for sending detection requests according to the addresses in the network state detection address set respectively to obtain a state code;
and the network connection determining module is used for determining that the terminal is in a network connection state when a preset state code exists in the state codes.
An electronic device comprising a memory storing a computer program and a processor that when executing the computer program performs the steps of:
acquiring a real-time geographic position of a terminal;
when the real-time geographic position is within a preset range, acquiring a network state detection address set;
sending detection requests according to the addresses in the network state detection address set respectively to obtain a state code;
and when the preset state code exists in the state codes, judging that the terminal is in a network communication state.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a real-time geographic position of a terminal;
when the real-time geographic position is within a preset range, acquiring a network state detection address set;
sending detection requests according to the addresses in the network state detection address set respectively to obtain a state code;
and when the preset state code exists in the state codes, judging that the terminal is in a network communication state.
The network detection method, the device, the electronic equipment and the storage medium acquire the real-time geographic position of the terminal, and acquire a network state detection address set when the real-time geographic position is within a preset range; respectively sending a detection request according to the addresses in the network state detection address set to obtain a state code; when the preset state code exists in the state code, the terminal is judged to be in a network connection state, so that the terminal can realize network connection through the addresses in the network state detection address set in the area where the terminal cannot access the network due to the network detection mechanism limited by the android native.
Drawings
FIG. 1 is a flow chart of a network detection method according to an embodiment;
FIG. 2 is a flowchart of a network detection method according to another embodiment;
FIG. 3 is a flowchart of a network detection method according to another embodiment;
FIG. 4 is a block diagram of a network detection device according to an embodiment;
fig. 5 is an internal structural diagram of an electronic device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a network detection method is provided, where the method is applied to a terminal to illustrate the method, it is understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 102, acquiring the real-time geographic position of the terminal.
The real-time geographic position of the terminal refers to the region where the terminal initiates the network access request, and the user can initiate the network access request by connecting the terminal with the network hotspot. For example, the commonly used area of the mobile terminal is a, when the wireless network coverage area of the area a uses the mobile terminal, a login authentication page can be displayed through an android native network detection mechanism, and a wireless network is accessed through a webpage login authentication mode. When the user uses the mobile terminal in the area B, the mobile terminal cannot normally display the login authentication page due to the network detection mechanism of the android native.
Step 104, when the real-time geographic position is within the preset range, a network state detection address set is obtained.
The preset range refers to an area where the login authentication page is located, which cannot be normally displayed when the mobile terminal initiates a network access request through an android native network detection mechanism. When the real-time geographic position of the terminal is detected to be in the preset range, a network state detection address set is acquired, wherein the network state detection address set comprises a plurality of network state detection addresses. The network state detection address refers to a server address corresponding to a region where the mobile terminal is currently located, for example, it is detected that the mobile terminal is located in a region a, and a public server address of the region a is obtained.
And 106, respectively sending detection requests according to the addresses in the network state detection address set to obtain state codes.
The probe request may specifically refer to an HTTP access request, and under the android native Network detection mechanism, the Network packet analysis tool Network Monitor performs HTTP access based on HTTPs (Hyper Text Transfer Protocol over Secure Socket Layer, hypertext transfer security protocol), and performs HTTP access based on HTTP (Hyper Text Transfer Protocol ), and performs Network connectivity determination according to a return result of the access. Wherein the HTTP access returns the result in the form of an HTTP status code, which is a 3-digit code used to represent the HTTP response status of the Web server. Specifically, when the returned HTTP status code is 204, it is determined that the network condition is a network. When the returned HTTP status code is not 204 between 200 and 399, the network condition is determined to be a redirect, which is to redirect a web site specified by the user to another web site. And when the returned HTTP status code is greater than or equal to 400, judging that the network condition is no network. The above-mentioned functions are disabled in some regions because the google website cannot be accessed by the android native network detection mechanism in some regions.
When the terminal is detected to be in the area with the functional failure, the public server in the corresponding area is directly adopted as a network state detection address set, and network detection is carried out through the addresses in the network state detection address set. Specifically, the addresses in the network state detection address set may include a self-contained server address, a public website server address, and a google server address. Considering that excessive HTTP access causes power consumption, one may be selected from the self-contained servers, one may be selected from the public website servers, one may be selected from the google server, and one may be selected from the HTTPs servers, thereby obtaining four sets of HTTP/HTTPs addresses, and forming a network status detection address set.
And step 108, when the preset state code exists in the state codes, judging that the terminal is in a network connection state.
Sending detection requests through addresses in the network state detection address set respectively to obtain state codes, and judging that the terminal is in a network direct connection state when a preset first state code exists in the state codes; when the first state code does not exist in the state codes and the preset second state code exists, the terminal is judged to be in a network address transfer communication state. Specifically, HTTP access may be performed by using addresses in the network state detection address set to obtain an HTTP state code, and when 204 exists in the HTTP state code, it is determined that the network condition is that a network exists. When 204 is not present in the HTTP status code, but a status code between 200 and 399 is present, the network condition is determined to be a redirect. Specifically, when a probe request is sent to an address in the network state detection address set, the probe request may be sent sequentially to a plurality of addresses. When probe requests are sent sequentially, HTTP status codes are obtained sequentially. The network condition is determined to be a network if only the HTTP status code of the existence 204 is obtained from any one of the addresses. Specifically, when a probe request is transmitted to an address in the network state detection address set, the probe request may be transmitted to a plurality of addresses at the same time. When probe requests are sent simultaneously, multiple HTTP status codes are obtained. The network condition is determined to be a network if only the HTTP status code of the existence 204 is obtained from any one of the addresses.
According to the network detection method, the real-time geographic position of the terminal is obtained, and when the real-time geographic position is within a preset range, a network state detection address set is obtained; respectively sending a detection request according to the addresses in the network state detection address set to obtain a state code; when the preset state code exists in the state code, the terminal is judged to be in a network connection state, so that the terminal can realize network connection through the addresses in the network state detection address set in the area where the terminal cannot access the network due to the network detection mechanism limited by the android native.
In one embodiment, when the first status code does not exist in the status codes and the preset second status code exists, the method further includes, after determining that the terminal is in the network address connection state: and obtaining a address corresponding to the preset second state code, and displaying a webpage login authentication page through the address. When the traditional Network detection mechanism detects the address transfer, the Network condition is judged by an iscaptivopoort function in a Network Monitor class of a Network data packet analysis tool. When the network condition exists and login identity authentication is needed, a corresponding login authentication application program is awakened to guide a user to finish login authentication. Because of the network detection mechanism of the android native, the login authentication application program uses the WebView control to open a corresponding webpage according to the address, and then displays the login authentication page through the WebView control address. Through the WebView control address transfer, the situation that the address of the addressed webpage is incomplete may occur, so that the login authentication page cannot be displayed. In the present application, when 204 is not present in the HTTP status code, it is determined whether non-204 between 200 and 399 is present in the HTTP status code, and when non-204 between 200 and 399 is present in the HTTP status code, it is determined that the network condition is the address transfer. When there is neither 204 nor 204 between 200 and 399 in the HTTP status code, the network condition is determined to be no network. And obtaining the address transfer address corresponding to the return address HTTP status code, and displaying the login authentication page through the address transfer address. That is, when the result returned by the HTTP access is the network status of the address transfer, the web page address corresponding to the network status determined to be the address transfer is obtained, and the login authentication application program uses the WebView control to open the corresponding web page according to the web page address. Therefore, the problem that the login authentication page cannot be displayed in the traditional method can be avoided, the access times to the webpage address can be reduced, and power consumption and flow are saved.
In one embodiment, as shown in fig. 2, the network detection method further includes: step 206, when the web page login authentication page is updated, obtaining a target address in the network state detection address set corresponding to the preset second state code, and performing network direct connection detection through the target address; in step 207, when detecting that the network direct connection fails, the network direct connection is detected by the standby address in the network status detection address set. In the traditional network detection mechanism, after a user successfully logs in through a login authentication page, a login authentication application program cannot be automatically closed on a large probability, and a network state identifier of the mobile terminal still displays no network, so that the mobile terminal cannot normally use an accessed network. Under the android native network detection mechanism, the login authentication application program judges that the user completes login authentication through each refreshing of the WebView control. And (3) re-performing network detection by using the web page address of the first detection network, closing the login authentication application program when the returned HTTP status code is 204, and switching the network of the mobile terminal to the wireless network corresponding to the login authentication page. The method is limited by an android native network detection mechanism, and a login authentication application program cannot be closed, so that the mobile terminal cannot access a network in some areas in a webpage login authentication mode. In the scheme of the application, HTTP access is performed through addresses in the network state detection address set, HTTP state codes are obtained, when a preset first state code does not exist in the state codes and a preset second state code exists in the state codes, the terminal is judged to be in a network address transfer communication state, address transfer addresses corresponding to the preset second state codes are obtained, and a webpage login authentication page is displayed through the address transfer addresses. When the WebView control updates the login authentication page, it is determined that the user has successfully login authenticated. The login authentication application program obtains a target address in a network state detection address set corresponding to a preset second state code, carries out network direct connection detection through the target address, and closes the login authentication application program when the HTTP state code returned by the network detection is 204, so as to control the mobile terminal to access the network corresponding to the login authentication page. When the HTTP status code returned by the network detection is not 204, namely network direct connection failure is detected, network direct connection detection is carried out through the standby address in the network status detection address set, when 204 exists in the HTTP status code returned by the standby address, the login authentication application program is closed, namely the updated login authentication page is closed, and the mobile terminal is controlled to access the network corresponding to the login authentication page.
In one embodiment, as shown in fig. 3, the network detection method further includes: step 305, obtaining a address corresponding to a preset second status code, and waking up a corresponding application program when the address contains a preset application program identifier; step 306, the login authentication page is displayed based on the awakened application. In an actual application scenario, a user may request access to a corresponding network by opening some application programs and logging in to an authentication page. Specifically, when the address contains a preset application program identifier, waking up a corresponding application program, and displaying a login authentication page based on the waken application program; and when the address does not contain the preset application program identifier, starting a program downloading function of the application program corresponding to the application program identifier. The function of the android native login authentication application program is expanded, so that the login authentication application program can log in and authenticate normally in other areas, and the problem that the mobile terminal cannot access to the network through the webpage login authentication mode in certain areas is solved. And adding a designated application program into a shoulldOverrideUrlLoading interface of the login authentication application program in advance, and waking up a corresponding application program when detecting that the application program to be woken up belongs to the designated application program. Specifically, a web address judgment of a specified application program is added to a shouldberide UrlLoading interface of a login authentication application program, and then when the web address of a login authentication request is detected to correspond to the specified application program, the corresponding application program is directly awakened through an Intent mechanism, and a login authentication page is displayed through the application program. In addition, the application program downloading function of the android native login authentication application program can be expanded by calling a downloading monitoring class. The downloading is monitored by customizing the Down LoadListener class and then setting the WebView monitoring event. For example, the setDownloadListener is removed from WebView, then the mywebview downloadlistener function is brought in, and the application downloading function of the android native login authentication application captureportal can be extended by using onDownloadStart callbackFunction (callback function) in the setDownloadListener.
In one embodiment, obtaining the real-time geographic location of the terminal comprises: acquiring longitude and latitude coordinates, and acquiring the real-time geographic position of the terminal according to the longitude and latitude coordinates; or acquiring corresponding base station information, and acquiring the real-time geographic position of the terminal according to the base station information; or acquiring the wireless network base station information, identifying the country code corresponding to the wireless network base station information, and acquiring the real-time geographic position of the terminal according to the country code. In particular, the latitude and longitude coordinates may be obtained by a positioning module, which may be a GPS (Global Positioning System ) module in particular. Taking a mobile phone as an example, in a non-flying mode, the communication module scans through a telecommunication network to acquire base station information, and can also acquire the base station information through a SIM (Subscriber Identification Module, subscriber identity module) card. In addition, the country code of the area where the wireless network base station is located can be obtained through the standard specification of the wireless network 802.11 d.
It should be understood that, although the steps in the flowcharts of fig. 1-3 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 1-3 may include multiple sub-steps or phases that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or phases are performed necessarily occur sequentially, but may be performed alternately or alternately with at least a portion of the sub-steps or phases of other steps or other steps.
In one embodiment, as shown in fig. 4, there is provided a network detection apparatus, including: a real-time location acquisition module 402, a detected address acquisition module 404, a detected address processing module 406, and a network connectivity determination module 408. A real-time location acquisition module 402, configured to acquire a real-time geographic location of the terminal. The detection address acquisition module 404 is configured to acquire a network status detection address set when the real-time geographic location is within a preset range. The detected address processing module 406 is configured to send a probe request according to the addresses in the network status detected address set, respectively, to obtain a status code. The network connectivity determining module 408 is configured to determine that the terminal is in a network connectivity state when a preset status code exists in the status codes.
In one embodiment, the network connectivity determining module is further configured to determine that the terminal is in a network direct connectivity state when a preset first status code exists in the status codes; when the preset first state code does not exist in the state codes and the preset second state code exists in the state codes, the terminal is judged to be in a network address transfer communication state.
In one embodiment, the network detection device further includes a login authentication module, configured to obtain a address corresponding to the preset second status code, and display a web login authentication page through the address.
In one embodiment, the network detection device further includes a network access module, configured to obtain a target address in a network state detection address set corresponding to a preset second status code when the web page login authentication page is updated, and perform network direct connection detection through the target address; when detecting that the network direct connection fails, the network direct connection detection is carried out through the standby addresses in the network state detection address set so as to enable the terminal to access the network.
In one embodiment, the network detection device further includes a function expansion module, configured to obtain a address corresponding to the preset second status code, and wake up a corresponding application when the address includes a preset application identifier; the wake-based application displays a login authentication page.
In one embodiment, the network detection device further includes a download expansion module, configured to start a program downloading function of an application program corresponding to the application program identifier when the address does not include the preset application program identifier.
In one embodiment, the real-time position obtaining module is further configured to obtain latitude and longitude coordinates, and obtain a real-time geographic position of the terminal according to the latitude and longitude coordinates; or acquiring corresponding base station information, and acquiring the real-time geographic position of the terminal according to the base station information; or acquiring the wireless network base station information, identifying the country code corresponding to the wireless network base station information, and acquiring the real-time geographic position of the mobile terminal according to the country code.
For specific limitation of the network detection device, reference may be made to the limitation of the network detection method hereinabove, and the description thereof is omitted herein. The modules in the network detection device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, an electronic device, which may be a mobile terminal, is provided, and fig. 5 provides an internal structural diagram of the mobile terminal. The mobile terminal includes a processor, a memory, and a display screen connected by a system bus. Wherein the processor is configured to provide computing and control capabilities. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The method executed by the terminal may be specifically implemented by a processor of the mobile terminal, i.e. the computer program when executed by the processor implements a network detection method.
It will be appreciated by those skilled in the art that the structure shown in fig. 5 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the terminal to which the present application is applied, and that a particular mobile terminal may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, an electronic device is provided comprising a memory storing a computer program and a processor that when executing the computer program performs the steps of: acquiring a real-time geographic position of a terminal, and acquiring a network state detection address set when the real-time geographic position is within a preset range; respectively sending a detection request according to the addresses in the network state detection address set to obtain a state code; when the preset state code exists in the state codes, the terminal is judged to be in a network connection state.
In one embodiment, the processor when executing the computer program further performs the steps of: when a preset first state code exists in the state codes, judging that the terminal is in a network direct communication state; when the first state code does not exist in the state codes and the preset second state code exists, the terminal is judged to be in a network address transfer communication state.
In one embodiment, the processor when executing the computer program further performs the steps of: and obtaining a address corresponding to the preset second state code, and displaying a webpage login authentication page through the address.
In one embodiment, the processor when executing the computer program further performs the steps of: when the webpage login authentication page is updated, a target address in a network state detection address set corresponding to a preset second state code is obtained, and network direct connection detection is carried out through the target address; when detecting that the network direct connection fails, the network direct connection detection is carried out through the standby addresses in the network state detection address set so as to enable the terminal to access the network.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a address transfer address corresponding to a preset second state code, and waking up a corresponding application program when the address transfer address contains a preset application program identifier; the wake-based application displays a login authentication page.
In one embodiment, the processor when executing the computer program further performs the steps of: and when the address does not contain the preset application program identifier, starting a program downloading function of the application program corresponding to the application program identifier.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring longitude and latitude coordinates, and acquiring the real-time geographic position of the terminal according to the longitude and latitude coordinates; or acquiring corresponding base station information, and acquiring the real-time geographic position of the terminal according to the base station information; or acquiring the wireless network base station information, identifying the country code corresponding to the wireless network base station information, and acquiring the real-time geographic position of the terminal according to the country code.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor further performs the steps of: acquiring a real-time geographic position of a terminal, and acquiring a network state detection address set when the real-time geographic position is within a preset range; respectively sending a detection request according to the addresses in the network state detection address set to obtain a state code; when the preset state code exists in the state codes, the terminal is judged to be in a network connection state.
In one embodiment, the computer program when executed by the processor further performs the steps of: when a preset first state code exists in the state codes, judging that the terminal is in a network direct communication state; when the first state code does not exist in the state codes and the preset second state code exists, the terminal is judged to be in a network address transfer communication state.
In one embodiment, the computer program when executed by the processor further performs the steps of: and obtaining a address corresponding to the preset second state code, and displaying a webpage login authentication page through the address.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the webpage login authentication page is updated, a target address in a network state detection address set corresponding to a preset second state code is obtained, and network direct connection detection is carried out through the target address; when detecting that the network direct connection fails, the network direct connection detection is carried out through the standby addresses in the network state detection address set so as to enable the terminal to access the network.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a address transfer address corresponding to a preset second state code, and waking up a corresponding application program when the address transfer address contains a preset application program identifier; the wake-based application displays a login authentication page.
In one embodiment, the computer program when executed by the processor further performs the steps of: and when the address does not contain the preset application program identifier, starting a program downloading function of the application program corresponding to the application program identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring longitude and latitude coordinates, and acquiring the real-time geographic position of the terminal according to the longitude and latitude coordinates; or acquiring corresponding base station information, and acquiring the real-time geographic position of the terminal according to the base station information; or acquiring the wireless network base station information, identifying the country code corresponding to the wireless network base station information, and acquiring the real-time geographic position of the terminal according to the country code.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.
Claims (10)
1. A method for network detection, the method comprising:
acquiring a real-time geographic position of a terminal;
when the real-time geographic position is within a preset range, acquiring a network state detection address set; the preset range refers to an area where a login authentication page cannot be normally displayed when the terminal initiates a network access request through an android native network detection mechanism; the network state detection address set comprises a plurality of server addresses corresponding to the current area where the terminal is located;
sending detection requests according to the addresses in the network state detection address set respectively to obtain a state code;
when a preset first state code exists in the state codes, judging that the terminal is in a network direct communication state;
when the preset first state code does not exist in the state codes and the preset second state code exists in the state codes, the terminal is judged to be in a network address transfer communication state;
and obtaining a address transfer address corresponding to the preset second state code, and displaying a webpage login authentication page through the address transfer address.
2. The method according to claim 1, wherein the method further comprises:
when the webpage login authentication page is updated, a target address in a network state detection address set corresponding to the preset second state code is obtained, and network direct connection detection is carried out through the target address;
and when detecting that the network direct connection fails, performing network direct connection detection through the standby address in the network state detection address set.
3. The method of claim 1, wherein after determining that the terminal is in the network-switched connected state when the preset first status code is absent and the preset second status code is present in the status codes, further comprising:
acquiring a transfer address corresponding to the preset second state code, and waking up a corresponding application program when the transfer address contains a preset application program identifier;
and displaying a login authentication page based on the awakened application program.
4. A method according to claim 3, characterized in that the method further comprises:
and when the address transfer address does not contain the preset application program identifier, starting a program downloading function of the application program corresponding to the application program identifier.
5. The method of claim 1, wherein the acquiring the real-time geographic location of the terminal comprises:
acquiring longitude and latitude coordinates, and acquiring a real-time geographic position of a terminal according to the longitude and latitude coordinates;
or alternatively, the first and second heat exchangers may be,
acquiring corresponding base station information, and acquiring the real-time geographic position of a terminal according to the base station information;
or alternatively, the first and second heat exchangers may be,
acquiring wireless network base station information, identifying a country code corresponding to the wireless network base station information, and acquiring the real-time geographic position of the terminal according to the country code.
6. A network detection apparatus, the apparatus comprising:
the real-time position acquisition module is used for acquiring the real-time geographic position of the terminal;
the detection address acquisition module is used for acquiring a network state detection address set when the real-time geographic position is within a preset range; the preset range refers to an area where a login authentication page cannot be normally displayed when the terminal initiates a network access request through an android native network detection mechanism; the network state detection address set comprises a plurality of server addresses corresponding to the current area where the terminal is located;
the detection address processing module is used for sending detection requests according to the addresses in the network state detection address set respectively to obtain a state code;
the network communication determining module is used for determining that the terminal is in a network direct communication state when a preset first state code exists in the state codes; when the preset first state code does not exist in the state codes and the preset second state code exists in the state codes, the terminal is judged to be in a network address transfer communication state;
and the login authentication module is used for acquiring a address transfer address corresponding to the preset second state code, and displaying a webpage login authentication page through the address transfer address.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the network access module is used for acquiring a target address in a network state detection address set corresponding to the preset second state code when the webpage login authentication page is updated, and performing network direct connection detection through the target address; and when detecting that the network direct connection fails, performing network direct connection detection through the standby address in the network state detection address set.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the function expanding module is used for acquiring a transfer address corresponding to the preset second state code, and waking up a corresponding application program when the transfer address contains a preset application program identifier; and displaying a login authentication page based on the awakened application program.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 5 when executing the computer program.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010441027.XA CN113709086B (en) | 2020-05-22 | 2020-05-22 | Network detection method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010441027.XA CN113709086B (en) | 2020-05-22 | 2020-05-22 | Network detection method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113709086A CN113709086A (en) | 2021-11-26 |
CN113709086B true CN113709086B (en) | 2023-07-18 |
Family
ID=78646260
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010441027.XA Active CN113709086B (en) | 2020-05-22 | 2020-05-22 | Network detection method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113709086B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104735736A (en) * | 2013-12-24 | 2015-06-24 | 中国移动通信集团公司 | Network access method and user terminal |
CN105873053A (en) * | 2016-03-29 | 2016-08-17 | 上海斐讯数据通信技术有限公司 | Method and system for embedding webpage on access authentication page, and wireless access point |
CN106341413A (en) * | 2016-09-29 | 2017-01-18 | 上海斐讯数据通信技术有限公司 | Portal authentication method and device |
CN106973386A (en) * | 2017-03-29 | 2017-07-21 | 联想(北京)有限公司 | A kind of wireless network access method, device and electronic equipment |
CN107294811A (en) * | 2017-07-28 | 2017-10-24 | 广东欧珀移动通信有限公司 | Network detecting method, network detection means and intelligent terminal |
CN107483594A (en) * | 2017-08-22 | 2017-12-15 | 北京小米移动软件有限公司 | The method and apparatus of display renewal entry |
CN108737350A (en) * | 2017-04-24 | 2018-11-02 | 腾讯科技(深圳)有限公司 | A kind of information processing method and client |
CN109640374A (en) * | 2017-10-09 | 2019-04-16 | 腾讯科技(深圳)有限公司 | Wireless network access, processing method, device, storage medium and computer equipment |
CN109802925A (en) * | 2017-11-17 | 2019-05-24 | 广州市动景计算机科技有限公司 | A kind of authentication method and system of public WiFi access |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8131847B2 (en) * | 2009-08-12 | 2012-03-06 | Cellco Partnership | Mechanism to detect restricted access via internet hotspot |
CN105007581B (en) * | 2015-08-12 | 2018-03-20 | 腾讯科技(深圳)有限公司 | A kind of network access authentication method and client |
CN106209970B (en) * | 2016-06-17 | 2018-02-23 | 上海连尚网络科技有限公司 | Determine the method and apparatus of network state connected between user equipment and routing device |
CN106714206B (en) * | 2016-09-29 | 2020-06-16 | 腾讯科技(深圳)有限公司 | Method and device for detecting wireless network access point connecting network |
CN108664493B (en) * | 2017-03-29 | 2021-09-03 | 北京京东尚科信息技术有限公司 | Method and device for counting validity of URL (Uniform resource locator), electronic equipment and storage medium |
CN108282783B (en) * | 2017-09-15 | 2021-03-09 | 阿里巴巴(中国)有限公司 | Public wifi authentication method, device, user terminal and storage medium |
CN109787811A (en) * | 2018-12-15 | 2019-05-21 | 深圳壹账通智能科技有限公司 | Network status data update method, device, computer equipment and storage medium |
CN110677852A (en) * | 2019-11-22 | 2020-01-10 | 广东睿盟计算机科技有限公司 | Network connection method, device, computer equipment and storage medium |
-
2020
- 2020-05-22 CN CN202010441027.XA patent/CN113709086B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104735736A (en) * | 2013-12-24 | 2015-06-24 | 中国移动通信集团公司 | Network access method and user terminal |
CN105873053A (en) * | 2016-03-29 | 2016-08-17 | 上海斐讯数据通信技术有限公司 | Method and system for embedding webpage on access authentication page, and wireless access point |
CN106341413A (en) * | 2016-09-29 | 2017-01-18 | 上海斐讯数据通信技术有限公司 | Portal authentication method and device |
CN106973386A (en) * | 2017-03-29 | 2017-07-21 | 联想(北京)有限公司 | A kind of wireless network access method, device and electronic equipment |
CN108737350A (en) * | 2017-04-24 | 2018-11-02 | 腾讯科技(深圳)有限公司 | A kind of information processing method and client |
CN107294811A (en) * | 2017-07-28 | 2017-10-24 | 广东欧珀移动通信有限公司 | Network detecting method, network detection means and intelligent terminal |
CN107483594A (en) * | 2017-08-22 | 2017-12-15 | 北京小米移动软件有限公司 | The method and apparatus of display renewal entry |
CN109640374A (en) * | 2017-10-09 | 2019-04-16 | 腾讯科技(深圳)有限公司 | Wireless network access, processing method, device, storage medium and computer equipment |
CN109802925A (en) * | 2017-11-17 | 2019-05-24 | 广州市动景计算机科技有限公司 | A kind of authentication method and system of public WiFi access |
Also Published As
Publication number | Publication date |
---|---|
CN113709086A (en) | 2021-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110099047B (en) | Registration information processing method and device, computer equipment and storage medium | |
EP3533247B1 (en) | Wireless network type detection method and electronic device | |
CN108959384B (en) | Webpage data acquisition method and device, computer equipment and storage medium | |
CN111866850A (en) | Configuration file switching method and device, computer equipment and storage medium | |
WO2022057429A1 (en) | Network registration method and apparatus, and user terminal and storage medium | |
US20210306974A1 (en) | Network search method, computer device, and computer-readable storage medium | |
US10136304B2 (en) | Method, device and terminal for mobile terminals to exchange user information | |
EP3905740B1 (en) | Sim card registration method and apparatus, computer device, and storage medium | |
CN111970330B (en) | Network communication method, device, computer equipment and storage medium | |
CN114157536A (en) | Equipment access method, device, equipment and storage medium based on intelligent gateway | |
KR20140033213A (en) | Method for accessing at least one service and corresponding system | |
CN104994501A (en) | Connection method of wireless network and terminal equipment | |
CN111328068B (en) | Card writing method and device, computer equipment and storage medium | |
CN113709086B (en) | Network detection method, device, electronic equipment and storage medium | |
CN114585055B (en) | Vehicle-mounted WiFi access method, vehicle controller, cloud server and mobile terminal | |
CN101316386A (en) | System and method for monitoring geographical position of stolen mobile phone | |
CN114556891A (en) | Method, device, equipment and storage medium for determining equipment state | |
CN108600964B (en) | Mobile terminal tracking and positioning system | |
CN112423288B (en) | Dialing analysis method, device, computer equipment and storage medium | |
CN113225788B (en) | WiFi connection method and device, electronic equipment and readable storage medium | |
CN113609881A (en) | Method, device and equipment for determining analog card to be activated and storage medium | |
CN103907383A (en) | Methods and devices for facilitating access terminal registration with a registration server | |
CN112188591A (en) | Network access method, device, computer equipment and storage medium | |
CN114222285B (en) | Roaming service processing method, apparatus, device and readable storage medium | |
CN114286400B (en) | Method and device for acquiring long-term evolution network service and computer equipment |
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 |