Disclosure of Invention
The embodiment of the invention provides a method and equipment for managing an application program, so that the application program management equipment sends a system application message to the application program according to the application state of the application program.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, a method for managing an application program is provided, including:
the application program management equipment acquires a system application message; the system application message comprises an attribute identifier, wherein the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier;
after the application program management equipment obtains the system application message, determining an application program subscribing the system application message, and obtaining an application state of the application program;
and processing the system application message through the application program when the application state of the application program corresponds to the attribute identification.
In a first possible implementation manner of the first aspect, the obtaining the state of the application includes:
querying a state list, wherein the state list is generated by an operating system according to the application state of the application program, and the state list comprises the application state of the application program;
and determining the application state of the application program according to the state list.
With reference to the first aspect or the first possible implementation manner, in a second possible implementation manner, the processing the system application message through the application program corresponding to the attribute identifier includes:
when the attribute identification comprises a foreground identification and the application program is in a foreground state, processing the system application message through the application program;
when the attribute identification comprises a background identification and the application program is in a background state, processing the system application message through the application program;
and when the attribute identification comprises an un-started identification and the application program is in an un-started state, processing the system application message through the application program.
With reference to any one of the first aspect to the second possible implementation manner, in a third possible implementation manner, before acquiring an application state of the application program, the method further includes:
the application program management equipment inquires an application program starting list;
determining whether to start the application program according to the query result; wherein the application program comprises an application program configured by the system.
With reference to the third possible implementation manner, in a fourth possible implementation manner, the application program startup list includes an identifier of the application program added by the user through the application program management device, or an identifier of the application program added by the application program through a system file access interface.
In a second aspect, there is provided an application management device comprising
The system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a system application message, the system application message comprises an attribute identifier, and the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier;
the processing unit is used for determining an application program subscribing the system application message after the acquisition unit acquires the system application message;
the obtaining unit is further configured to obtain an application state of the application program;
the processing unit is further configured to process the system application message through the application program when the application state of the application program acquired by the acquisition unit corresponds to the attribute identifier.
In a first possible implementation manner of the second aspect, the obtaining unit is specifically configured to query a state list, and determine an application state of the application program according to the state list, where the state list is generated by an operating system according to the application state of the application program, and the state list includes the application state of the application program.
With reference to the second aspect or the first possible implementation manner of the second aspect, in a second possible implementation manner, the processing unit is specifically configured to,
when the attribute identification comprises a foreground identification and the application program is in a foreground state, processing the system application message through the application program;
when the attribute identification comprises a background identification and the application program is in a background state, processing the system application message through the application program;
and when the attribute identification comprises an un-started identification and the application program is in an un-started state, processing the system application message through the application program.
With reference to the second aspect to the second possible implementation manner of the second aspect, in a third possible implementation manner,
the application management device further includes:
the query unit is used for querying an application program starting list before the acquisition unit acquires the application state of the application program;
the starting unit is used for determining whether to start the application program according to the query result of the query unit; wherein the application program comprises an application program configured by the system.
With reference to the third possible implementation manner, in a fourth possible implementation manner, the application program launch list includes an identifier of the application program added by the user through the application program management device, or an identifier of the application program added by the application program through a system file access interface.
By adopting the scheme, the application program management equipment obtains the system application message; the system application message comprises an attribute identifier, the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier, and after the application program management device obtains the system application message, an application program subscribing the system application message is determined, and the application state of the application program is obtained; when the application state of the application corresponds to the attribute identification, the system application message is processed by the application. Therefore, the application program management device can send the system application message to the application program according to the application state of the application program, and the situation that when the application program is in a background state or an un-started state and the system application message needs to be processed in a foreground, the application program management device still processes the system application message through the application program to increase the load of the system and the occupied memory is avoided.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
An embodiment of the present invention provides a method for managing an application, where as shown in fig. 2, an execution subject of the embodiment of the method is an application management device, and the method further includes:
s101, the application program management equipment obtains a system application message.
The system application message comprises an attribute identifier, the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier, and the system application message is generated by the operating system.
It should be noted that the format of the system application message including the attribute identifier is as follows:
<intent-filter>
<action
android:name="android.intent.action.user-define-action-name"/>
<category android.intent.category.background/>
</intent-filter>
the action and the category define to constitute a system application message, where the background in the < category android.
S102, after the application program management device obtains the system application message, the application program management device determines an application program subscribed to the system application message and obtains an application state of the application program.
Specifically, when the system message queue of the application program includes the system application message, it is determined that the application program subscribes to the system application message, the application program management device queries a status list, and determines an application state of the application program according to the status list.
The state list is generated by the operating system according to the application state of the application program, the state list includes the application state of the application program, and the operating system may be an Android system.
S103, when the application state of the application program corresponds to the attribute identification, the application program management device processes the system application message through the application program.
Specifically, when the attribute identifier includes a foreground identifier and the application is in a foreground state, the application management device processes the system application message through the application;
when the attribute identifier comprises a background identifier and the application program is in a background state, the application program management device processes the system application message through the application program;
when the attribute identifier comprises an un-started identifier and the application program is in an un-started state, the application program management device processes the system application message through the application program.
It should be noted that, if the attribute identifier includes a foreground identifier, a background identifier, and an un-started identifier, the application management device may process the system application message through the application program no matter the application program is in any state.
Illustratively, when the attribute identifier of the system application message is a foreground identifier and the application program is in a foreground state, the application program management device processes the system application message through the application program; therefore, when the application program is in the background state, the data and the corresponding interface state do not need to be refreshed, and the data only needs to be updated when the application program is switched from the background state to the foreground state, so that the system load caused by monitoring the system application message in the background is reduced; when the attribute identifier of the system application message is a background identifier and the application program is in a background state, the application program management device processes the system application message through the application program, and when the attribute identifier of the system application message is an un-started identifier, the application program is awakened and processes the system application message even if the application program is not started.
Further, in the prior art, when a system is started, a BOOT startup message (e.g., a BOOT _ complete message) is broadcast, if a configuration file corresponding to the application program in the system includes an identifier of the BOOT startup message (i.e., indicating that the application program registers the BOOT startup message), the application program receives the BOOT startup message and starts according to the BOOT startup message, because whether the application program registers the BOOT startup message is pre-configured in the system, when the system is started, the application program that a user does not want to start is still started or the application program that the user wants to start is not started, and therefore, before the application device obtains an application state of the application program, the application device queries an application program start list and determines whether to start the application program according to a query result.
Wherein the application may be an application configured by the system itself. The application startup list includes the identification of the application added by the user through the application management device or the identification of the application added by the application through the system file access interface.
That is, the addition of the identifier of the application program to the application program launch list includes the following two ways:
the first method is as follows: the user adds the identification of the application to the application launch list through the application management device.
Specifically, the application is configured with a start option provided to the user, and the user determines whether to start the application with the start of the system through the start option, for example, the setting option of the application includes an option of "automatically running this program when starting up", for the user, the "automatically running this program when starting up" in the setting option of the application is not selected, if the user wants the application to be automatically started up when starting up the system, the setting option is selected, at this time, the identifier of the application is added to the start-up list of the application, and if the user does not want the application to be started up when starting up the system, the setting option is not changed.
The second method comprises the following steps: and the application program adds the identification of the application program through the system file access interface.
Specifically, the system file access interface supports the application program to access the system file, and the application program accesses the system file through the system file access interface, so that the identifier of the application program is added to the application program start list.
Specifically, when the system is started, the application program actively accesses the system file access interface, so that the addition of the identifier of the application program is realized, for example, for a user, the "auto-run this program" in the setting options of the application program is selected, if the user wants the application program to be automatically started when the system is started, the setting options are not changed, if the user does not want the application program to be started when the system is started, the setting options are deselected, and at this time, the identifier of the application program is also removed from the application program start list.
It should be noted that, as can be seen from the above first and second modes, for the user, in the first mode, the option of "automatically running the application at startup" of the application is default to being unselected, and the user may set the option according to the need of the user, and in the second mode, the option of "automatically running the application at startup" of the application is default to being selected, and the user may set the option according to the need of the user, that is, in the first mode, the user determines whether to add the identifier of the application to the application start list according to the need of the user, and in the second mode, the user determines whether to remove the identifier of the application from the application start list according to the need of the user because the application start list already includes the identifier of the application.
In addition, the application program may include an application program configured by the system itself, that is, the authority of the application program is higher than that of a third party application program installed by a user, and the higher authority application program can obtain more services from the system.
Specifically, after the user completes configuration of application program start, the application program management device determines whether to add an identifier of the application program to the application program start list according to the setting of the user, and after the system is powered on again, the application program management device queries the application program start list, so as to determine whether to start the application program according to the application program start list.
Further, the querying of the application start list by the application management device includes the following two cases:
the first condition is as follows: the application management device queries a first application launch list.
The first application program starting list comprises identification of application programs to be started.
Specifically, since the first application program launch list includes the identifier of the application program that needs to be launched when the system is launched, the application program management device launches the application program when determining that the first application program launch list includes the identifier of the application program, and obtains a launch instruction when determining that the first application program launch list does not include the identifier of the application program, and launches the application program according to the launch instruction; that is to say, when the first application program start list includes the identifier of the application program, the application program corresponding to the identifier of the application program is automatically started when the system is started, and when the first application program start list does not include the identifier of the application program, that is, it indicates that the application program corresponding to the identifier of the application program does not need to be automatically started when the system is started, therefore, when the application program management device obtains the start instruction corresponding to the application program triggered by the user through the terminal, the application program is started.
In case two, the application management device queries the second application launch list.
Wherein the second application launch list includes an identification of applications that are not launched.
Specifically, since the second application startup list includes the identifier of the application that does not need to be automatically started at system startup, the application management device receives a startup instruction when determining that the second application startup list includes the identifier of the application, starts the application according to the startup instruction, and starts the application when determining that the second application startup list does not include the identifier of the application, that is, when the second application startup list includes the identifier of the application, that is, when the second application startup list indicates that the application corresponding to the identifier of the application does not need to be automatically started at system startup, therefore, when the application management device acquires the startup instruction corresponding to the application triggered by the user, the application is started, and when the second application startup list does not include the identifier of the application, and when the system is started, automatically starting the application program corresponding to the identification of the application program.
By adopting the scheme, the application program management device can send the system application message to the application program according to the application state of the application program, so that the situation that when the application program is in a background state or an un-started state and the system application message needs to be processed in a foreground, the application program management device still processes the system application message through the application program to increase the load of the system and the occupied memory is avoided.
An embodiment of the present invention provides a method for managing an application program, and as shown in fig. 2, the method includes:
s201, after the operating system is started, the application program management equipment acquires a system application message.
The system application message comprises an attribute identifier, wherein the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier.
It should be noted that the format of the system application message including the attribute identifier is as follows:
<intent-filter>
<action
android:name="android.intent.action.user-define-action-name"/>
<category android.intent.category.background/>
</intent-filter>
the action and the category define to constitute a system application message, where the background in the < category android.
S202, after the application management device obtains the system application message, the application management device determines an application program subscribed to the system application message.
Specifically, when the system message queue of the application program includes the system application message, it is determined that the application program subscribes to the system application message, the application program management device queries a status list, and determines an application state of the application program according to the status list.
The state list is generated by the operating system according to the application state of the application program, the state list includes the application state of the application program, and the operating system may be an Android system.
S203, the application management apparatus queries the application start list.
And S204, the application program management equipment determines whether to start the application program according to the query result.
Wherein the application may be an application configured by the system itself. The application startup list includes the identification of the application added by the user through the application management device or the identification of the application added by the application through the system file access interface.
That is, the addition of the identifier of the application program to the application program launch list includes the following two ways:
the first method is as follows: the user adds the identification of the application to the application launch list through the application management device.
Specifically, the application is configured with a start option provided to the user, and the user determines whether to start the application with the start of the system through the start option, for example, the setting option of the application includes an option of "automatically running this program when starting up", for the user, the "automatically running this program when starting up" in the setting option of the application is not selected, if the user wants the application to be automatically started up when starting up the system, the setting option is selected, at this time, the identifier of the application is added to the start-up list of the application, and if the user does not want the application to be started up when starting up the system, the setting option is not changed.
The second method comprises the following steps: and the application program adds the identification of the application program through the system file access interface.
Specifically, the system file access interface supports the application program to access the system file, and the application program accesses the system file through the system file access interface, so that the identifier of the application program is added to the application program start list.
Specifically, when the system is started, the application program actively accesses the system file access interface, so that the addition of the identifier of the application program is realized, for example, for a user, the "auto-run this program" in the setting options of the application program is selected, if the user wants the application program to be automatically started when the system is started, the setting options are not changed, if the user does not want the application program to be started when the system is started, the setting options are deselected, and at this time, the identifier of the application program is also removed from the application program start list.
It should be noted that, as can be seen from the above first and second modes, for the user, in the first mode, the option of "automatically running the application at startup" of the application is default to being unselected, and the user may set the option according to the need of the user, and in the second mode, the option of "automatically running the application at startup" of the application is default to being selected, and the user may set the option according to the need of the user, that is, in the first mode, the user determines whether to add the identifier of the application to the application start list according to the need of the user, and in the second mode, the user determines whether to remove the identifier of the application from the application start list according to the need of the user because the application start list already includes the identifier of the application.
Wherein the application program comprises an application program configured by the system.
Specifically, the querying of the application start list by the application management device includes the following two cases:
the first condition is as follows: the application management device queries a first application launch list.
The first application program starting list comprises identification of application programs to be started.
Specifically, since the first application program launch list includes the identifier of the application program that needs to be launched when the system is launched, the application program management device launches the application program when determining that the first application program launch list includes the identifier of the application program, and obtains a launch instruction when determining that the first application program launch list does not include the identifier of the application program, and launches the application program according to the launch instruction; that is to say, when the first application program start list includes the identifier of the application program, the application program corresponding to the identifier of the application program is automatically started when the system is started, and when the first application program start list does not include the identifier of the application program, that is, it indicates that the application program corresponding to the identifier of the application program does not need to be automatically started when the system is started, therefore, when the application program management device obtains the start instruction corresponding to the application program triggered by the user through the terminal, the application program is started.
In case two, the application management device queries the second application launch list.
Wherein the second application launch list includes an identification of applications that are not launched.
Specifically, since the second application startup list includes the identifier of the application that does not need to be automatically started at system startup, the application management device receives a startup instruction when determining that the second application startup list includes the identifier of the application, starts the application according to the startup instruction, and starts the application when determining that the second application startup list does not include the identifier of the application, that is, when the second application startup list includes the identifier of the application, that is, when the second application startup list indicates that the application corresponding to the identifier of the application does not need to be automatically started at system startup, therefore, when the application management device acquires the startup instruction corresponding to the application triggered by the user, the application is started, and when the second application startup list does not include the identifier of the application, and when the system is started, automatically starting the application program corresponding to the identification of the application program.
S205, the application management device queries the status list of the application.
The state list is generated by the operating system according to the application state of the application program, and the state list comprises the application state of the application program.
And S206, the application program management device determines the application state of the application program according to the state list.
It should be noted that, after the application program is started, the user may set the application state of the application program to a foreground state or a background state.
And S207, when the application state of the application program corresponds to the attribute identification, the application program management device processes the system application message through the application program.
Specifically, when the attribute identifier includes a foreground identifier and the application is in a foreground state, the application management device processes the system application message through the application.
And when the attribute identifier comprises a background identifier and the application program is in a background state, the application program management device processes the system application message through the application program.
When the attribute identifier comprises an un-started identifier and the application program is in an un-started state, the application program management device processes the system application message through the application program.
It should be noted that, if the attribute identifier includes a foreground identifier, a background identifier, and an un-started identifier, the application management device may process the system application message through the application program no matter the application program is in any state.
Illustratively, when the attribute identifier of the system application message is a foreground identifier and the application program is in a foreground state, the application program management device processes the system application message through the application program; therefore, when the application program is in the background state, the data and the corresponding interface state do not need to be refreshed, and the data only needs to be updated when the application program is switched from the background state to the foreground state, so that the system load caused by monitoring the system application message in the background is reduced; when the attribute identifier of the system application message is a background identifier and the application program is in a background state, the application program management device processes the system application message through the application program, and when the attribute identifier of the system application message is an un-started identifier, the application program is awakened and processes the system application message even if the application program is not started.
By adopting the scheme, the application program management device can send the system application message to the application program according to the application state of the application program, so that the situation that when the application program is in a background state or an un-started state and the system application message needs to be processed in a foreground, the application program management device still processes the system application message through the application program to increase the load of the system and the occupied memory is avoided.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are all described as a series of action combinations, but those skilled in the art should understand that the present invention is not limited by the described action sequence. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
An embodiment of the present invention provides an application management device 30, as shown in fig. 3, including:
an obtaining unit 30, configured to obtain a system application message.
The system application message comprises an attribute identifier, wherein the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier.
It should be noted that the format of the system application message including the attribute identifier is as follows:
<intent-filter>
<action
android:name="android.intent.action.user-define-action-name"/>
<category android.intent.category.background/>
</intent-filter>
the action and the category define to constitute a system application message, where the background in the < category android.
The processing unit 31 is configured to determine an application program subscribed to the system application message after the obtaining unit 30 obtains the system application message.
The obtaining unit 30 is further configured to obtain an application state of the application program.
The processing unit 31 is further configured to process the system application message through the application program when the application state of the application program acquired by the acquiring unit 30 corresponds to the attribute identification.
Specifically, the obtaining unit 30 is specifically configured to query a status list, and determine an application status of the application program according to the status list.
The state list is generated by the operating system according to the application state of the application program, and the state list comprises the application state of the application program.
Further, the processing unit 31 is specifically configured to,
when the attribute identification comprises a foreground identification and the application program is in a foreground state, processing the system application message through the application program;
when the attribute identifier comprises a background identifier and the application program is in a background state, processing the system application message through the application program;
and when the attribute identification comprises an un-started identification and the application program is in an un-started state, processing the system application message through the application program.
It should be noted that, if the attribute identifier includes a foreground identifier, a background identifier, and an un-started identifier, the application management device may process the system application message through the application program no matter the application program is in any state.
Illustratively, when the attribute identifier of the system application message is a foreground identifier and the application program is in a foreground state, the application program management device processes the system application message through the application program; therefore, when the application program is in the background state, the data and the corresponding interface state do not need to be refreshed, and the data only needs to be updated when the application program is switched from the background state to the foreground state, so that the system load caused by monitoring the system application message in the background is reduced; when the attribute identifier of the system application message is a background identifier and the application program is in a background state, the application program management device processes the system application message through the application program, and when the attribute identifier of the system application message is an un-started identifier, the application program is awakened and processes the system application message even if the application program is not started.
Further, as shown in fig. 4, the application management device 30 further includes:
the query unit 33 is configured to query the application start list before the obtaining unit obtains the application state of the application.
A starting unit 34, configured to determine whether to start the application program according to the query result of the querying unit 33.
Wherein the application program comprises an application program configured by the system.
Optionally, the application launch list includes an identification of the application added by the user through the application management device.
Specifically, the application is configured with a start option provided to the user, and the user determines whether to start the application with the start of the system through the start option, for example, the setting option of the application includes an option of "automatically running this program when starting up", for the user, the "automatically running this program when starting up" in the setting option of the application is not selected, if the user wants the application to be automatically started up when starting up the system, the setting option is selected, at this time, the identifier of the application is added to the start-up list of the application, and if the user does not want the application to be started up when starting up the system, the setting option is not changed.
Optionally, the application adds the identification of the application through a system file access interface.
Specifically, the system file access interface supports the application program to access the system file, and the application program accesses the system file through the system file access interface, so that the identifier of the application program is added to the application program start list.
Specifically, when the system is started, the application program actively accesses the system file access interface, so that the addition of the identifier of the application program is realized, for example, for a user, the "auto-run this program" in the setting options of the application program is selected, if the user wants the application program to be automatically started when the system is started, the setting options are not changed, if the user does not want the application program to be started when the system is started, the setting options are deselected, and at this time, the identifier of the application program is also removed from the application program start list.
By adopting the application program management device, the application program management device can send the system application message to the application program according to the application state of the application program, so that the situation that when the application program is in a background state or an un-started state and the system application message needs to be processed in a foreground, the application program management device still processes the system application message through the application program to increase the load of the system and the occupied memory is avoided.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process and description of the application management device described above may refer to the corresponding process in the method embodiment described in the foregoing fig. 1, and details are not described herein again.
An embodiment of the present invention provides an application management device 50, as shown in fig. 5, where the application management device includes: a processor (processor)51, a communication Interface (Communications Interface)52, a memory (memory)53, and a communication bus 54; wherein, the processor 51, the communication interface 52 and the memory 53 complete mutual communication through the communication bus 54.
The processor 51 may be a central processing unit CPU or an application specific Integrated circuit asic or one or more Integrated circuits configured to implement embodiments of the present invention.
The memory 53 is used to store program code, which includes computer operating instructions. The memory 53 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The communication interface 52 is used for realizing connection communication between the devices.
The processor 51 executing program code for obtaining a system application message; the system application message comprises an attribute identifier, wherein the attribute identifier comprises at least one of a foreground identifier, a background identifier and an un-started identifier; after the system application message is obtained, determining an application program subscribed to the system application message, and obtaining an application state of the application program; when the application state of the application corresponds to the attribute identification, the system application message is processed by the application.
Optionally, the processor 51 is specifically configured to query a state list, where the state list is generated by an operating system according to an application state of the application program, the state list includes the application state of the application program, and determine the application state of the application program according to the state list.
Optionally, the processor 51 is specifically configured to, when the attribute identifier includes a foreground identifier and the application is in a foreground state, process the system application message through the application, when the attribute identifier includes a background identifier and the application is in a background state, process the system application message through the application, and when the attribute identifier includes an un-started identifier and the application is in an un-started state, process the system application message through the application.
Optionally, the processor 51 is further configured to, before obtaining the application state of the application, query the application start list by the application management device, and determine whether to start the application according to a query result.
Wherein the application program comprises an application program configured by the system.
Optionally, the application startup list includes an identifier of the application added by the user through the application management device, or an identifier of the application added by the application through the system file access interface.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.