Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
A network connection method and apparatus of a terminal device according to an embodiment of the present invention are described below with reference to the drawings.
Fig. 1 is a flowchart illustrating a network connection method of a terminal device according to an embodiment of the present invention.
As shown in fig. 1, the method comprises the steps of:
step 101, acquiring a network connection fault message of an application program in terminal equipment;
the terminal device can be understood as a mobile phone, a personal computer or other devices which need to be connected with a network in a wired or wireless manner. The network connection failure message of the application program can be understood as a message which is broadcast when the application program on the terminal equipment cannot obtain network data when the application program is connected with the network.
Specifically, in the working process of the terminal device, the network connection state of the application program on the terminal device can be continuously monitored according to the application program and the like which are established in the embodiment of the application and are installed on the terminal device in advance, and when the connection fault of the network connection of the application program is monitored, or when the network connection fault message is actively sent by the application program, the network connection fault message of the application program is obtained.
Of course, in practical applications, due to reasons such as unstable network connection signals of an environment where the terminal device is located, the network connection failure message of the application program may be monitored even when the terminal device has no network connection failure, and therefore, in an embodiment of the present application, after the network connection failure message of the application program of the terminal device is acquired, it is further necessary to determine the authenticity of the network connection failure message of the application program.
In an embodiment of the present application, as shown in fig. 2, after acquiring the network connection failure message of the application program of the terminal device, the target terminal device may also be controlled to send the network connection test information to the network monitoring server, and the terminal device determines that the confirmation message of the network monitoring server for the network connection test information is not acquired within the preset time, which indicates that the terminal device does have a failure in network connection. And if the terminal equipment determines that the confirmation message of the network monitoring server to the network connection test information is obtained within the preset time, the terminal equipment is indicated to be normal in network connection.
The network monitoring server is arranged on the network and used for monitoring and responding to the network connection test information of the terminal equipment. In addition, the terminal device may send the network connection test information as a ping request or an http request.
Step 102, responding to a network connection fault message, and determining at least M target network recovery objects in preset N network recovery objects, wherein M is less than or equal to N and greater than or equal to 1;
the network recovery object may be understood as an object related to the network connection of the application, and the network recovery object may also be multiple, and for example, may include a network interface, a network connection chip, and the like. Specifically, the terminal number device responds to the network connection failure message, and then determines at least M target network restoration objects among preset N network restoration objects by analyzing the network connection failure message, wherein M is less than or equal to N and greater than or equal to 1. That is, in the present application, according to a specific network connection failure message, the corresponding M target network recovery objects are determined, which facilitates to quickly recover the connection to the network.
In different application scenarios, the manner of determining at least M target network restoration objects among preset N network restoration objects is different, and the following is illustrated as an example:
example one:
in this example, all of the preset N network restoration objects are directly determined as the target network restoration objects, and thus, restoration of the guaranteed network connection is restored by traversing all the network restoration objects.
Example two:
in this example, M target network restoration objects are determined in a targeted manner according to the network connection failure message, so that the restoration efficiency of the network connection is improved.
In this embodiment, after the network connection failure message is obtained, network connection parameter information is obtained, where the network connection parameter information may include a network speed, a network throughput rate, and the like in different application scenarios. The network connection parameter information of the terminal device may be obtained by analyzing the network connection failure message, or may be obtained by querying the network parameter of the terminal device after the network connection failure message is obtained.
And then, setting the corresponding relation between the network connection parameters and the target network recovery object, inquiring the corresponding relation, and acquiring the target network recovery object corresponding to the current network fault message.
For example, in this embodiment, when the network speed is 0, it indicates that all the N network recovery objects are likely to be the cause of the connection failure, and thus, it is determined that all the N network recovery objects are the target network recovery object.
When the network speed is greater than 0, the network connection fault caused by the related network recovery objects such as the network access point is definitely not present, and therefore, the network recovery objects except the related network recovery objects such as the network access point in the N network recovery objects are determined to be the target network recovery objects.
Step 103, aiming at each target network recovery object in the M target network recovery objects, executing a recovery processing mode corresponding to each target network recovery object to realize network connection to the terminal device.
The recovery processing mode is related to a networking mode of the corresponding target network recovery object, for example, when the target network recovery object is a network interface, the corresponding recovery processing mode is restart, for example, when the target network recovery object is a network access point, the corresponding recovery processing mode is a handover operation, and the like.
In some embodiments, the corresponding relationship between the target network recovery object and the recovery processing mode may be established in advance, the target network recovery object may be used in the application process, and a specific recovery processing mode may be obtained by querying the corresponding relationship between the target network recovery object and the recovery processing mode. In this embodiment, according to the determined M target network restoration objects, a corresponding restoration processing manner is executed, so as to restore the network connection of the terminal device. The whole network connection recovery process is relatively automatic, manual participation is avoided, and the network connection recovery efficiency is improved.
It should be understood that, in different practical application scenarios, for each target network restoration object in the M target network restoration objects, the restoration processing manner corresponding to each target network restoration object is different, and the following example is illustrated as follows:
example one:
in this example, as shown in fig. 3, the determined recovery processing modes need to be sorted.
Step 201, acquiring execution sequences of M target network recovery objects;
the execution sequence of the target network recovery object may be determined according to the frequency of the failure of the relevant device in the process of connecting the application program in the terminal device to the network, or may be default in the system.
Specifically, the obtained M target network recovery objects are sorted according to a preset execution sorting method, so as to obtain execution sequence results of the M target network recovery objects.
Step 202, according to the execution sequence, starting from the first target network recovery object, executing the corresponding recovery processing mode until the network connection to the terminal device is realized.
Specifically, according to the execution sequence of the M target network recovery objects, starting from the first target network recovery object, the recovery processing mode corresponding to the target network recovery object is executed until the terminal device recovers the network connection.
Of course, in some possible examples, there may be many target network recovery objects, and at this time, in order to recover the network connection as soon as possible, the recovery time may be counted from the first recovery starting processing manner, and when the counted result is greater than a certain time, the recovery processing manner corresponding to the target network recovery object that is the last in the execution sequence is directly executed. For example, after the recovery processing mode is executed in the specified order from the start of the recovery processing mode, the time reaches 2 minutes, and at this time, the corresponding recovery processing mode is not executed in the order, but the recovery processing mode corresponding to the target network recovery object at the last of the execution order is directly skipped to solve the failure as soon as possible.
Different target network recovery objects correspond to different recovery processing modes, for example, when M target network recovery objects include network access points, the corresponding recovery processing mode is to acquire legal network access points of the terminal device; judging whether the network access point is consistent with a legal network access point or not; and if so, performing recovery operation on the recovery processing mode corresponding to the next target network recovery object according to the execution sequence. If the network connection is not consistent with the target network recovery object, the network access point is switched to a legal network access point and whether the terminal equipment recovers the network connection or not is judged, if the terminal equipment recovers the network connection, the network recovery process is ended, and if the terminal equipment does not recover the network connection, recovery operation is carried out on a recovery processing mode corresponding to the next target network recovery object according to the execution sequence.
For another example, when the M target network recovery objects include a mobile data access interface, the corresponding recovery processing mode is to switch the mobile data access interface to a preset mobile data access interface; and controlling a preset mobile data access interface to access mobile data, ending the network recovery process if the terminal equipment recovers the network connection, and performing recovery operation on a recovery processing mode corresponding to the next target network recovery object according to the execution sequence if the terminal equipment does not recover the network connection.
For another example, when M target network recovery objects include a baseband system, the corresponding recovery processing mode is to restart the baseband system, and add one to the counter to record the restart times; after restarting the baseband system, detecting whether the terminal equipment recovers the network connection; if the network connection is recovered, ending the network recovery process, and if the network connection is not recovered, judging whether the restart times are greater than the target restart times; and if the number of times of restarting is less than or equal to the target number of times, adding the counter and restarting the baseband system after the preset first time, and detecting whether the terminal equipment recovers the network connection. And if the number of times of restarting is more than or equal to the target number of times, resetting the counter and adding the counter and restarting the baseband system after a preset second time, wherein the second time is more than the first time.
Example two:
in this example, a restart priority may be set in advance for M target network recovery objects, where the restart priority may be determined according to restart time consumption, and the higher the restart time consumption is, the higher the corresponding restart priority is set, and in this embodiment, a target network recovery object corresponding to a restart priority at the highest level among the M target network recovery objects may be selected to directly perform a corresponding recovery processing manner. For example, the M target network restoration objects respectively include four target network restoration objects, namely, a first target network restoration object, a second target network restoration object, a third target network restoration object and a fourth target network restoration object, where the four target network restoration objects have a certain relevance, and a restoration process performed on the fourth target network restoration object can solve a network connection failure caused by the three target network restoration objects, and at this time, for each of the four target network restoration objects, the method for executing the restoration processing mode corresponding to each target network restoration object is to directly execute the restoration processing mode corresponding to the fourth target network restoration object.
In summary, according to the network connection method of the terminal device in the embodiment of the present disclosure, a network connection failure message of an application program in the terminal device is obtained; responding to a network connection fault message, and determining at least M target network recovery objects in preset N network recovery objects, wherein M is less than or equal to N and greater than or equal to 1; and aiming at each target network recovery object in the M target network recovery objects, executing a recovery processing mode corresponding to each target network recovery object to realize network connection to the terminal equipment. The problem of among the prior art terminal equipment when appearing unable internet surfing or the net speed is very slow, resume normal connection and use long time is solved.
In order to implement the foregoing embodiments, an embodiment of the present invention further provides a network connection device for a terminal device.
Fig. 4 is a schematic structural diagram of a network connection device of a terminal device according to an embodiment of the present invention.
As shown in fig. 4, the apparatus includes: an acquisition module 41, a determination module 42, and an execution module 43.
An obtaining module 41, configured to obtain a network connection failure message of an application program in a terminal device;
a determining module 42, configured to determine, in response to the network connection failure message, at least M target network restoration objects from among preset N network restoration objects, where M is less than or equal to N and greater than or equal to 1;
an executing module 43, configured to execute, for each target network recovery object of the M target network recovery objects, a recovery processing manner corresponding to that for each target network recovery object, so as to implement network connection for the terminal device.
In an embodiment of the present application, when M is greater than 1, the execution module 43 is specifically configured to:
and executing a recovery processing mode corresponding to each target network recovery object aiming at each target network recovery object in the M target network recovery objects so as to realize network connection aiming at the terminal equipment. Wherein, the execution step comprises:
the execution module 43 obtains the execution order for the M target network recovery objects; the execution sequence of the target network recovery object may be determined according to the frequency of the failure of the relevant device in the process of connecting the application program in the terminal device to the network, or may be default in the system. Therefore, the executing module 43 sequences the obtained M target network recovery objects according to a preset execution sequencing method, and obtains the execution sequence result of the M target network recovery objects.
Then, the execution module 43 executes the corresponding recovery processing mode from the first target network recovery object according to the execution sequence until the network connection to the terminal device is realized. That is, it can be understood that, according to the execution sequence of the M target network recovery objects, starting from the first target network recovery object, the execution module 43 executes the recovery processing manner corresponding to the target network recovery object until the terminal device recovers the network connection.
In an embodiment of the present application, when the recovery object for the M target networks includes a network access point, the execution module 43 is specifically configured to:
the execution module 43 obtains a legal network access point of the terminal device; judging whether the network access point is consistent with a legal network access point or not; and if so, performing recovery operation on the recovery processing mode corresponding to the next target network recovery object according to the execution sequence. If the network connection is not consistent with the target network recovery object, the network access point is switched to a legal network access point and whether the terminal equipment recovers the network connection or not is judged, if the terminal equipment recovers the network connection, the network recovery process is ended, and if the terminal equipment does not recover the network connection, recovery operation is carried out on a recovery processing mode corresponding to the next target network recovery object according to the execution sequence.
It should be noted that the foregoing explanation of the method embodiment is also applicable to the apparatus of this embodiment, and is not repeated herein.
In summary, according to the network connection apparatus of the terminal device in the embodiment of the present disclosure, the obtaining module obtains the network connection failure message of the application program in the terminal device; the determining module determines at least M target network recovery objects in preset N network recovery objects in response to the network connection fault message, wherein M is less than or equal to N and greater than or equal to 1; the execution module executes a recovery processing mode corresponding to each target network recovery object in the M target network recovery objects so as to realize network connection for the terminal equipment. Therefore, the problems that when the terminal equipment meets some network problems and network connection faults occur, the user can only force the terminal equipment to restart, the restarting time is long, and the service quality of the terminal equipment is influenced are solved, the time for the terminal equipment to recover the network connection is shortened, and the use experience of the user is improved.
In order to implement the foregoing embodiment, the present invention further provides a terminal device for network connection of a terminal device, where the terminal device includes: the network connection method of the terminal device is realized by the program executed by the processor.
Fig. 5 is a diagram illustrating a hardware structure of a terminal device according to an embodiment of the present invention.
As shown in fig. 5, the terminal device 1100 may include a wireless communication unit 1110, an a/V (audio/video) input unit 1120, a user input unit 1130, a sensing unit 1140, an output unit 1150, a memory 1160, an interface unit 1170, a controller 1180, a power supply unit 1190, and the like. Fig. 5 shows a terminal device having various components, but it is to be understood that not all of the illustrated components are required to be implemented. More or fewer components may alternatively be implemented.
The wireless communication unit 1110 allows, among other things, radio communication between the terminal device 1100 and a wireless communication system or network. The a/V input unit 1120 is for receiving an audio or video signal. The user input unit 1130 may generate key input data to control various operations of the terminal device according to a command input by a user. The sensing unit 1140 detects the current state of the terminal device 1100, the temperature of the terminal device 1100, the position of the terminal device 1100, the presence or absence of a touch input by a user to the terminal device 1100, the orientation of the terminal device 1100, the acceleration or deceleration movement and direction of the terminal device 1100, and the like, and generates a command or signal for controlling the operation of the terminal device 1100. The interface unit 1170 serves as an interface through which at least one external device is connected to the terminal apparatus 1100. The output unit 1150 is configured to provide output signals in a visual, audio, and/or tactile manner. The memory 1160 may store software programs and the like for processing and controlling operations performed by the controller 1180, or may temporarily store data that has been output or is to be output. Memory 1160 may include at least one type of storage media. Also, the terminal apparatus 1100 may cooperate with a network storage device that performs a storage function of the memory 1160 through a network connection. The controller 1180 generally controls the overall operation of the terminal device. In addition, the controller 1180 may include a multimedia module for reproducing or playing back multimedia data. The controller 1180 may perform a pattern recognition process to recognize a handwriting input or a picture drawing input performed on the touch screen as a character or an image. The power supply unit 1190 receives external power or internal power and provides appropriate power required to operate the various elements and components under the control of the controller 1180.
In order to implement the foregoing embodiments, an embodiment of the present invention also proposes a non-transitory storage medium on which a computer program is stored, which when executed by a processor implements the network connection method of the terminal device as described in the foregoing method embodiments.
FIG. 6 is a schematic diagram illustrating a non-transitory storage medium according to an embodiment of the present invention. As shown in fig. 6, a non-transitory storage medium 300, in accordance with an embodiment of the present invention, has non-transitory computer readable instructions 301 stored thereon. The non-transitory computer readable instructions 301, when executed by a processor, perform all or part of the steps of the network connection method of the terminal device of the embodiments of the present invention described above.