Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and a system for controlling application networking based on a mobile terminal data service, aiming at the above-mentioned defects in the prior art. The invention provides an application networking control method based on a mobile terminal data service, and aims to solve the problem that in the prior art, when the data service is started, a plurality of applications are simultaneously connected with a network, and more flows of users are consumed.
The technical scheme adopted by the invention for solving the technical problem is as follows:
an application networking control method based on mobile terminal data service, comprising:
a, establishing an application program stack in advance; the application program stack comprises a stack top pointer, and the stack top pointer points to the application program which is operated in the foreground at the latest time; if the application program is not operated in the front and the background of the mobile terminal, the stack top pointer is empty;
B. when detecting that the data service is enabled, acquiring an application program pointed by a stack top pointer in the application program stack; returning to null if the stack top pointer is null;
C. and only starting networking on the application program pointed by the stack top pointer, and stopping networking on the application programs except the application program pointed by the stack top pointer.
The application networking control method based on the mobile terminal data service further comprises the following steps after the step C:
and D, when the data service is in an open state and the application program pointed by the stack top pointer is changed, only opening networking for the application program pointed by the current stack top pointer, and closing networking for the application programs except the application program pointed by the current stack top pointer.
The application networking control method based on the mobile terminal data service further comprises the following steps after the step C:
and S, when the data service is in an open state and the application program pointed by the stack top pointer is changed, increasing the number of applications pointed by the current stack top pointer to open networking, wherein all the applications which are switched to the foreground or newly opened after the data service is opened are all opened for networking, and the rest applications are all closed for networking.
The application networking control method based on the mobile terminal data service is characterized in that the application program stack is used for storing the application programs which are operated in the foreground by a user according to the time sequence, the foreground operation program closest to the current time is arranged on the top of the stack, and then the application programs which are operated in the foreground are stored in the application program stack according to the distance from the current time; the application program which was operated in the foreground is ranked below the application program which was far away from the current time, and ranked above the application program which was near the current time; when an application saved in the application stack is closed, it is deleted in the application stack.
An application networking control system based on mobile terminal data service, comprising:
the pre-establishing module is used for pre-establishing an application program stack; the application program stack comprises a stack top pointer, and the stack top pointer points to the application program which is operated in the foreground at the latest time; if the application program is not operated in the front and the background of the mobile terminal, the stack top pointer is empty;
the acquisition module is used for acquiring the application program pointed by the top pointer in the application program stack when the data service is detected to be enabled; returning to null if the stack top pointer is null;
and the control module is used for only starting networking on the application program pointed by the stack top pointer and closing networking on the application programs except the application program pointed by the stack top pointer.
The application networking control system based on the mobile terminal data service further comprises:
and the first switch module of the data service is used for only starting networking on the application program pointed by the current stack top pointer and closing networking on the application programs except the application program pointed by the current stack top pointer when the data service is in an open state and the application program pointed by the stack top pointer is changed.
The application networking control system based on the mobile terminal data service further comprises:
and when the data service is in an open state and the application program pointed by the stack top pointer changes, the data service second switch module increases the starting networking of the application program pointed by the current stack top pointer, all the application programs which are switched to the foreground or are newly started after the data service is started are all started for networking, and the rest application programs are all stopped for networking.
The application networking control system based on the mobile terminal data service is characterized in that the application program stack is used for storing application programs which are operated in the foreground by a user according to the time sequence, the foreground operation program closest to the current time is arranged on the top of the stack, and then the application programs which are operated in the foreground are stored in the application program stack according to the distance from the current time; the application program which was operated in the foreground is ranked below the application program which was far away from the current time, and ranked above the application program which was near the current time; when an application saved in the application stack is closed, it is deleted in the application stack.
The method saves the application program which is operated by the foreground at the latest time by establishing the application program stack, only allows the application program to be networked when the data service is started, and only allows the application program which is operated by the foreground to be networked later, so that the data flow is pointed, thereby solving the problem that a plurality of applications are simultaneously connected with the network and consume more flow of users when the data service is started in the prior art.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for controlling application networking based on data services of a mobile terminal according to a preferred embodiment of the present invention. As shown in fig. 1, the application networking control method based on mobile terminal data service according to the embodiment of the present invention includes the following steps:
s100, establishing an application program stack in advance; the application program stack comprises a stack top pointer, and the stack top pointer points to the application program which is operated in the foreground at the latest time; if the application program is not operated in the front and the background of the mobile terminal, the stack top pointer is empty;
the application program stack is used for storing the application programs which are operated in the foreground by a user according to the time sequence, the foreground operation program closest to the current time is arranged on the top of the stack, and then the application programs which are operated in the foreground are stored in the application program stack according to the distance from the current time; the application program which was operated in the foreground is ranked below the application program which was far away from the current time, and ranked above the application program which was near the current time; when an application saved in the application stack is closed, it is deleted in the application stack. For example, if the user opens the WeChat first, the top pointer of the application stack points to the WeChat at this time as shown in FIG. 2, then opens the Payment Bao, the Jingdong, and the Gaode map in sequence, then the top pointer of the application stack points to the Gaode map at this time as shown in FIG. 3, if the user closes the Jingdong in the background at this time and deletes the Jingdong in the application stack, the top pointer of the application stack still points to the Gaode map at this time as shown in FIG. 4, and if the user closes the Gaode map again, the top pointer of the application stack points to the Payment Bao at this time as shown in FIG. 5.
S200, when the data service is detected to be enabled, acquiring an application program pointed by a stack top pointer in the application program stack; and returning to null if the stack top pointer is null.
As shown in fig. 2, when it is detected that the data service is enabled, the application program pointed by the top pointer in the application program stack is acquired as WeChat.
As shown in fig. 3, when it is detected that the data service is enabled, the application program pointed to by the top pointer in the application program stack is obtained as a high level map.
As shown in fig. 5, when it is detected that the data service is enabled, the application pointed by the top pointer in the application stack is obtained as a payroll.
S300, only starting networking on the application program pointed by the stack top pointer, and stopping networking on the application programs except the application program pointed by the stack top pointer;
for example, when the current application stack is shown in fig. 5 with the top pointer pointing to the payer, networking is turned on only for the payer, and networking is turned off for applications other than the payer.
As shown in fig. 3, when the top pointer of the current application stack points to the high-level map, the networking is only opened for the high-level map, and the networking is closed for all applications except the high-level map.
S400, when the data service is in an open state and the application program pointed by the stack top pointer changes, only the networking is opened for the application program pointed by the current stack top pointer, and the networking is closed for the application programs except the application program pointed by the current stack top pointer.
That is, after the user opens the data service, the user will always open networking only for the application program pointed by the current top pointer, and close networking for all application programs except the application program pointed by the current top pointer.
Of course, as another embodiment of the method of the present invention, if the user needs to have multiple applications for networking, the embodiment further provides step S500 as follows, and it should be noted that both step S400 and step S500 can be selected only.
S500, when the data service is in an open state and the application program pointed by the stack top pointer changes, the networking of the application program pointed by the current stack top pointer is increased, that is, all the application programs which are switched to the foreground or are newly opened after the data service is opened are all opened for networking, and the networking of the other application programs is closed.
Therefore, the invention provides an application networking control method based on a mobile terminal data service, and aims to solve the problem that in the prior art, when the data service is started, a plurality of applications are simultaneously connected with a network, and more flow of a user is consumed.
Based on the above method embodiment, the present invention further provides an application networking control system based on mobile terminal data service, as shown in fig. 6, the system includes:
apre-establishment module 210, configured to pre-establish an application stack; the application program stack comprises a stack top pointer, and the stack top pointer points to the application program which is operated in the foreground at the latest time; if the application program is not operated in the front and the background of the mobile terminal, the stack top pointer is empty; as described above.
An obtainingmodule 220, configured to obtain, when it is detected that the data service is enabled, an application program pointed by a top pointer in the application program stack; returning to null if the stack top pointer is null; as described above.
Thecontrol module 230 is configured to only open networking for the application program pointed by the top pointer, and close networking for all application programs except the application program pointed by the top pointer; as described above.
Further, the application networking control system based on the mobile terminal data service further comprises:
the first switch module of the data service is used for only starting networking on the application program pointed by the current stack top pointer and closing networking on the application programs except the application program pointed by the current stack top pointer when the data service is in an open state and the application program pointed by the stack top pointer is changed; as described above.
Further, the application networking control system based on the mobile terminal data service further comprises:
when the data service is in an open state and the application program pointed by the stack top pointer changes, the data service second switch module increases to open networking on the application program pointed by the current stack top pointer, all the application programs which are switched to a foreground or are newly opened after the data service is opened are all opened for networking, and the rest application programs are all closed for networking; as described above.
Further, the application networking control system based on the mobile terminal data service is characterized in that the application program stack is used for storing the application programs which are run by the user on the foreground according to the time sequence, the foreground running program closest to the current time is arranged on the top of the stack, and then the application programs which are run on the foreground are stored in the application program stack according to the distance from the current time; the application program which was operated in the foreground is ranked below the application program which was far away from the current time, and ranked above the application program which was near the current time; when the application program saved in the application program stack is closed, deleting the application program in the application program stack; as described above.
In summary, the method and system for controlling application networking based on mobile terminal data service provided by the present invention stores the application program that has been operated in the foreground last time by establishing an application program stack, and only allows the application program to be networked when the data service is started, and only allows the application program that is being operated in the foreground to be networked later, so that the data traffic is targeted, thereby solving the problem that many applications are connected to the network at the same time when the data service is started in the prior art and consume more traffic of users.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.