Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the present application provides a network handover method and apparatus.
In a first aspect, the present application provides a network handover method, including:
acquiring a current first network state of a main card;
acquiring a current second network state of the auxiliary card;
comparing the first network state with the second network state to obtain a comparison result;
when the comparison result represents that the second network state is better than the first network state, network switching information is generated; and the network switching information is used for prompting a user to switch to the auxiliary card for network connection.
Further, as the foregoing network switching method, before obtaining the current first network state of the master card, the method further includes:
identifying first operator information of the primary card;
identifying second operator information for the secondary card;
judging whether the first operator information is the same as the second operator information;
if the first operator information is the same as the second operator information or the second operator information is empty, the remaining steps are not executed;
and if the first operator information is different from the second operator information, the next step is transferred to the step of acquiring the current first network state of the main card.
Further, as the foregoing network switching method, between the step of acquiring the current first network state of the primary card and the step of acquiring the current second network state of the secondary card, the method further includes:
acquiring first signal strength of the main card according to the first network state;
judging whether the first signal intensity is lower than a preset signal intensity threshold value or not;
and when the first signal intensity is lower than a preset signal intensity threshold value, activating the secondary card to search for the network state.
Further, as in the foregoing network handover method, when the first signal strength is lower than a preset signal strength threshold, activating the secondary card to perform network state search includes:
acquiring the residence time of the first signal strength lower than the preset signal strength threshold;
judging whether the residence time is higher than a preset residence time threshold value or not;
and when the first signal strength is lower than the preset signal strength threshold value and the residence time length is higher than the preset residence time length threshold value, activating the secondary card to search the network state.
Further, as the foregoing network switching method, between acquiring a current first network state of the primary card and acquiring a current second network state of the secondary card, the method further includes:
acquiring the current network type of the main card according to the first network state;
judging whether the main card is currently positioned in the network system with the highest priority or not according to the current network system and the preset network system priority;
and when the current network system of the main card is not the network system with the highest priority, activating the auxiliary card to search the network state.
Further, as in the foregoing network switching method, when the current network type of the primary card is not the network type with the highest priority, activating the secondary card to perform network state search includes:
acquiring the duration of the main card in the current network system;
judging whether the duration is higher than a preset duration upper limit threshold or not;
and when the current network system of the main card is not the network system with the highest priority and the duration is higher than the preset duration upper limit threshold, activating the auxiliary card to search the network state.
Further, as the foregoing network switching method, between acquiring a current first network state of the primary card and acquiring a current second network state of the secondary card, the method further includes:
acquiring the switching frequency of the master card among different network systems according to the first network state;
judging whether the switching frequency is higher than a preset switching frequency upper limit threshold value or not;
and when the switching frequency is higher than the preset switching frequency upper limit threshold, activating the secondary card to search the network state.
Further, as the foregoing network switching method, after acquiring the current first network state of the master card, the method further includes:
acquiring current position information according to the first network state;
judging third network state information corresponding to the current position information according to the current position information and a pre-recorded position information table; wherein the pre-recorded position information table has recorded therein: correspondingly set position information and third network state information;
and when the signal strength information corresponding to the current position information represents the signal difference, activating the secondary card to search the network state.
In a second aspect, the present application provides a network switching apparatus, including:
the main card information acquisition module is used for acquiring the current first network state of the main card;
the auxiliary card information acquisition module is used for acquiring the current second network state of the auxiliary card;
the comparison module is used for comparing the first network state with the second network state and obtaining a comparison result;
the switching module is used for generating network switching information when the comparison result represents that the second network state is better than the first network state; and the network switching information is used for prompting a user to switch to the auxiliary card for network connection.
In a third aspect, the present application provides an electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to, when executing the computer program, implement the network handover method according to any one of the first aspect.
In a fourth aspect, the present application provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the network handover method of any of the first aspects.
The embodiment of the application provides a network switching method and a network switching device, wherein the method comprises the following steps: acquiring a current first network state of a main card; acquiring a current second network state of the auxiliary card; comparing the first network state with the second network state to obtain a comparison result; when the comparison result represents that the second network state is better than the first network state, network switching information is generated; and the network switching information is used for prompting a user to switch to the auxiliary card for network connection. By the method, the signal state of the auxiliary card can be measured when the signal of the main card is weak, the signal intensity of the main card and the signal intensity of the auxiliary card are compared, so that the mobile terminal is always registered in a relatively good network, and the problems of power consumption increase, slow internet surfing, telephone disconnection, unclear voice and the like caused by poor signal of the main card network of the terminal are reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a network switching method provided in an embodiment of the present application, including:
s1, acquiring a current first network state of a main card;
specifically, the main card may be an operation card currently used for connecting the terminal to the network, or an operation card set by the user and preferentially used;
s2, acquiring a current second network state of the auxiliary card;
specifically, the secondary card may be an operation card that is located in the same terminal as the primary card and is not currently connected to the network, or may be an operation card used for being used simultaneously with the primary card or for being used as a backup; the second network state and the first network state are used for representing information such as the current signal intensity, the network stability and the network system of the main card; for example: the network standard is 4G, and the signal intensity is-105 to-120 dbm; furthermore, one or more auxiliary cards can be provided, and when a plurality of auxiliary cards are provided, the operation cards with the best network state can be obtained only by sequentially comparing according to the method in the application;
s3, comparing the first network state with the second network state to obtain a comparison result;
in general, the alignment method may be: comparing the current network type of the first network state and the second network state, and comparing the current signal strength of the first network state and the second network state; the alignment result may be: information for characterizing a better state of one of the networks; so that the operation card with better network state can be selected for network connection at the later stage;
s4, when the comparison result represents that the second network state is better than the first network state, generating network switching information; the network switching information is used for prompting a user to switch to the auxiliary card for network connection;
that is, when the network state of the secondary card not used for connecting to the network is better than the network state of the primary card currently connected to the network, network switching information is generated; the network switching information may be a prompt message for prompting a user to perform network switching, or may be an information instruction for automatically controlling network switching, and how to set the network switching information is specifically selected according to an actual use condition.
As shown in fig. 2, in some embodiments, the network switching method as described above further includes the following steps S51 to S55 before the step S1 of acquiring the current first network state of the master card:
s51, identifying first operator information of the main card;
s52, identifying second operator information of the auxiliary card;
specifically, identifying operator information of operation cards respectively inserted into a main card and an auxiliary card in the terminal; for example, the operator information may be: china unicom, china mobile and chinese telecommunications;
s53, judging whether the first operator information is the same as the second operator information;
that is, whether operators corresponding to the main card and the auxiliary card are the same or not is judged;
s54, if the first operator information is the same as the second operator information or the second operator information is empty, the rest steps are not executed;
specifically, when the first operator information is the same as the second operator information, it means that the base stations providing services to the primary card and the secondary card are the same, so that the network states are the same, and even if the operator cards are switched, the purpose of obtaining a better network cannot be achieved; when the second operator information is empty, it means that only one operation card is inserted into the terminal, and the operation card cannot be switched; therefore, subsequent steps such as acquiring the current first network state of the main card and acquiring the current second network state of the auxiliary card are not necessary;
s55, if the first operator information is different from the second operator information, the next step is transferred to the step of acquiring the current first network state of the main card;
that is, only when the operation cards of at least two different operators are inserted into the terminal, the corresponding discrimination flow required for network switching is executed.
As shown in fig. 3, in some embodiments, the network switching method as described above further includes the following steps S61 to S63 between the step S1 of acquiring the current first network state of the primary card and the step S2 of acquiring the current second network state of the secondary card:
s61, acquiring first signal intensity of the main card according to the first network state;
that is, there may be one or more messages in the first network state, which is the first signal strength of the master card extracted from the first network state;
s62, judging whether the first signal intensity is lower than a preset signal intensity threshold value or not;
specifically, a signal strength threshold for triggering a corresponding process of network handover is preset, and the signal strength threshold may be set according to a specific use condition, generally, on the basis of ensuring normal network communication;
s63, activating the auxiliary card to search the network state when the first signal intensity is lower than a preset signal intensity threshold value;
that is, when the first signal strength is not enough to ensure that normal network communication can be maintained, the secondary card is activated to perform network state search, and then the network state of the secondary card at the current position is acquired.
Thus, by the steps in this embodiment, the search for the network state of the secondary card can be performed after the first signal strength of the primary card is lower than a certain value; otherwise, when the first signal strength of the main card is not judged, the network state of the auxiliary card is searched in real time to obtain a second network state and compared, so that the power consumption of the terminal is greatly improved, the standby time of the mobile phone is influenced, and the user experience is seriously influenced.
As shown in fig. 4, in some embodiments, as in the foregoing network handover method, the step S63 activates the secondary card to perform the network status search when the first signal strength is lower than the preset signal strength threshold, including the following steps S631 to S633:
s631, acquiring the residence time of the first signal intensity lower than a preset signal intensity threshold;
that is, when the first signal strength is lower than the preset signal strength threshold, the residence time of the master card in the weak signal state needs to be acquired, and the residence time is used as a factor for whether to perform network switching;
s632, judging whether the residence time is higher than a preset residence time threshold value;
specifically, a residence time threshold for triggering a corresponding network switching process is preset, the residence time threshold may be set according to a specific use condition, and generally, the residence time threshold is selected based on that normal network communication is not affected in the time interval;
and S633, when the first signal intensity is lower than a preset signal intensity threshold value and the residence time length is higher than a preset residence time length threshold value, activating the secondary card to search for the network state.
For example, take the preset residence time threshold as 5 minutes: when the acquired signal strength is weak and the weak signal duration exceeds a certain duration, such as 4 minutes, the secondary card is not activated to search the network state; and when the duration accumulation of the weak signals exceeds 5 minutes, the conditions are met, and the auxiliary card is activated to search the network state.
As shown in fig. 5, in some embodiments, the network switching method as described above further includes the following steps S71 to S73 between the step S1 of acquiring the current first network state of the primary card and the step S2 of acquiring the current second network state of the secondary card:
s71, acquiring the current network type of the main card according to the first network state;
specifically, the first network state includes information corresponding to the network type, so that the current network type of the master card can be obtained from the first network state; the network system comprises: 4G, 3G and 2G;
s72, judging whether the main card is currently located in the network system with the highest priority or not according to the current network system and the preset network system priority;
generally, network system priorities are arranged from fast to slow in data transmission speed; by way of example: when the main card supports 3 network systems of 4G, 3G and 2G, the network system priority is 4G, 3G and 2G; and preferentially carrying out communication in a 4G network system; therefore, whether the main card is currently located in the 4G network system or not is judged;
and S73, when the current network system of the main card is not the network system with the highest priority, activating the auxiliary card to search the network state.
By judging the current network system of the main card, the terminal can judge whether the current network system is in the network system with the fastest data transmission speed, when the current network system is not the network system with the highest priority, the auxiliary card is activated to carry out network state search so as to judge the network system which can be obtained by the auxiliary card at the current position, and when the priority of the network system of the auxiliary card is higher than that of the main card, subsequent network switching is carried out; by way of example: when the main card is: 3G network system of China Mobile; and the auxiliary card is a China Unicom 4G network system, and is switched to be the auxiliary card. Therefore, the situation that when the main card is located in a low-priority network system and the signal strength is good, network switching cannot be triggered, the internet surfing speed is further influenced, and the user experience is reduced can be avoided.
As shown in fig. 6, in some embodiments, as the foregoing network switching method, in step S73, when the current network type of the primary card is not the network type with the highest priority, activating the secondary card to perform a network state search, including steps S731 to S733 as follows:
s731, acquiring the duration of the main card in the current network system;
that is, when the current network system is not the network system with the highest priority, the residence time of the master card in the state of the low-priority network system needs to be acquired, and the residence time is used as a factor for whether to perform network switching;
s732, judging whether the duration is higher than a preset duration upper limit threshold;
specifically, a time length upper limit threshold used for triggering a corresponding network switching process is preset, the time length upper limit threshold can be set according to a specific use condition, and generally, the selection of the time length upper limit threshold is subject to the condition that normal network communication cannot be influenced in the time length interval;
s733, when the current network system of the main card is not the network system with the highest priority and the duration is higher than a preset duration upper limit threshold, activating the auxiliary card to search for the network state;
for example, the preset upper threshold of the duration is 5 minutes: when the main card is in the low-priority network system and the time length of the low-priority network system exceeds a certain time length, such as 4 minutes, the auxiliary card is not activated to search the network state; and when the duration accumulation of the weak signals exceeds 5 minutes, the conditions are met, and the auxiliary card is activated to search the network state.
As shown in fig. 7, in some embodiments, the network switching method as described above further includes the following steps S81 to S83 between the step S1 of acquiring the current first network state of the primary card and the step S2 of acquiring the current second network state of the secondary card:
s81, acquiring switching frequency of the master card among different network systems according to the first network state;
specifically, the first network state may be collected continuously in a time length range, so that the switching times between different network systems performed by the master card in the time length range can be obtained through statistics, and a corresponding switching frequency is obtained;
s82, judging whether the switching frequency is higher than a preset switching frequency upper limit threshold value;
specifically, a switching upper limit threshold for triggering a corresponding process of network switching is preset, and the switching upper limit threshold may be set according to a specific use condition, and generally, the switching upper limit threshold is selected on the premise that normal network communication is not affected in the switching frequency interval;
s83, activating the auxiliary card to search the network state when the switching frequency is higher than a preset switching frequency upper limit threshold;
for example, take the upper threshold of switching as 10 minutes and 6 times as an example: when the network system of the main card is obtained and frequently switched within a certain time, if the network system is switched for 7 times within 10 minutes, the terminal network switches and registers back and forth between 4G and 3G/2G within ten minutes, namely, the conditions are met; after the processing unit, namely the determining unit, determines that the conditions are met, activating the auxiliary card to search the network state; when the network system of the acquired main card is frequently switched for 5 times in 10 minutes within a certain time, that is, the terminal network switches and registers back and forth for 5 times in 4G and 3G/2G within ten minutes, the condition is not met. Therefore, whether network switching is carried out or not can be judged according to the residence stability of the main card, and the problems of network blockage, high power consumption and the like caused by frequent network switching can be effectively solved.
As shown in fig. 8, in some embodiments, the network switching method as described above further includes steps S91 to S93 as follows after acquiring the current first network state of the master card in step S1:
s91, acquiring current position information according to the first network state;
specifically, the first network state may further include information such as geographic location information and a base station identifier, where a specific information type may not be limited as long as current location information can be obtained;
s92, judging signal strength information corresponding to the current position information according to the current position information and a pre-recorded position information table; wherein, the position information table recorded in advance has: correspondingly setting position information and signal strength information;
that is, different third network state information of each location can be obtained according to historical experience (wherein the third network state information may include signal strength, network type, and residence stability), and the third network state information and the location information are correspondingly written into the location information table; furthermore, the position information table can be obtained through the record of the terminal, on the basis, a plurality of position information tables can be obtained through a plurality of terminals, and are uploaded to the cloud end for gathering, and then are synchronized to the local of each terminal (during synchronization, selective synchronization can be carried out according to the conventional activity range of each terminal); and furthermore, an accurate network switching method based on big data can be realized, an accurate judgment criterion for judging whether switching is needed or not is provided for a user, and the use experience of the user is greatly improved.
And S93, activating the auxiliary card to search the network state when the signal strength information corresponding to the current position information represents the signal difference.
In a second aspect, as shown in fig. 9, an embodiment of the present application further provides a network switching apparatus, including:
the main card information acquisition module 1 is used for acquiring a current first network state of a main card;
the auxiliary card information acquisition module 2 is used for acquiring the current second network state of the auxiliary card;
the comparison module 3 is used for comparing the first network state with the second network state and obtaining a comparison result;
the switching module 4 is used for generating network switching information when the comparison result represents that the second network state is better than the first network state; and the network switching information is used for prompting the user to switch to the auxiliary card for network connection.
Specifically, the specific process of implementing the functions of each module in the apparatus according to the embodiment of the present invention may refer to the related description in the method embodiment, and is not described herein again.
An embodiment of the present application further provides an electronic device, as shown in fig. 10, including: the electronic device may include: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501 is configured to implement the steps of the above-described method embodiments when executing the program stored in the memory 1503.
The bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The embodiment of the present application further provides a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions enable a computer to execute the network switching method in the foregoing method embodiment.
It should be noted that, for the above-mentioned apparatus, electronic device and non-transitory computer-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is simple, and for the relevant points, refer to the partial description of the method embodiments.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.