The application is a divisional application, the application number of the original application is 201410758987.3, the application date is 2014, 12 and 10, and the invention name is 'method for describing the plug-in installation package and mobile terminal'.
Disclosure of Invention
The invention provides a method for describing a plug-in installation package and a mobile terminal, and mainly aims to solve the technical problem of how to enable the mobile terminal to acquire identity information of an APK (android package).
In order to achieve the above object, the present invention provides a method for describing a plug-in installation package, where the method for describing a plug-in installation package includes:
creating a program for describing the identity information of the plug-in android package APK in the plug-in android package APK according to a preset rule;
under the condition that the main camera APK and the plug-in android package APK are communicated with each other, the main camera APK analyzes the program and acquires identity information of the plug-in android package APK.
Preferably, after the program for creating the identity information describing the plug-in android package APK in the plug-in android package APK according to the preset rule, the method further includes:
and storing the program in a preset directory of the plug-in android package APK.
Preferably, the identity information at least includes at least one or more of a name of the plug-in, a name of a class of the program describing the plug-in, an identifier of whether a front camera of the mobile terminal supports the application of the plug-in, and an identifier of whether the mobile terminal installs the application of the plug-in.
Preferably, the program for creating, according to a preset rule, identity information describing plug-in android package APK in plug-in android package APK includes:
creating a program of 'plugin. xml' under an attributes directory of the plug-in android package APK;
xml "is:
<plugin-features>
<package name="A1"></package><class
name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>
wherein "A1" is the name of the plug-in; "a2" is the name of the class of the program of the plug-in, "mode-supported-front > true" ", which indicates that the front camera supports the plug-in, and" < mode-supported-local > true "", which indicates that the mobile terminal installs the application of the plug-in.
Preferably, when the main camera APK and the plug-in android package APK communicate with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK, including:
InputStreampluginXmlInput=pluginContext.getAssets().open("plugin.xml");
wherein, the 'plugin.xml' is:
<plugin-features>
<package name="A1"></package><class
name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>;
plugin context.getassets (). open ("plugin.xml") is a program that parses the "plugin.xml" created under the asserts directory of the plug-in android package APK.
In addition, to achieve the above object, the present invention also provides a mobile terminal, including:
the creating unit is used for creating a program for describing the identity information of the plug-in android package APK in the plug-in android package APK according to a preset rule;
and the obtaining unit is used for analyzing the program by the main camera APK and obtaining the identity information of the plug-in android package APK under the condition that the main camera APK and the plug-in android package APK are communicated with each other.
Preferably, the mobile terminal further includes:
and the storage unit is used for storing the program in a preset directory of the plug-in android package APK.
Preferably, the identity information at least includes at least one or more of a name of the plug-in, a name of a class of the program describing the plug-in, an identifier of whether a front camera of the mobile terminal supports the application of the plug-in, and an identifier of whether the mobile terminal installs the application of the plug-in.
Preferably, the creating unit includes:
creating a program of 'plugin. xml' under an attributes directory of the plug-in android package APK;
xml is
<plugin-features>
<package name="A1"></package><class
name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>
Wherein "A1" is the name of the plug-in; "a2" is the name of the class of the program of the plug-in, "mode-supported-front > true" ", which indicates that the front camera supports the plug-in, and" < mode-supported-local > true "", which indicates that the mobile terminal installs the application of the plug-in.
Preferably, the acquiring unit includes:
InputStreampluginXmlInput=pluginContext.getAssets().open("plugin.xml");
wherein, the 'plugin.xml' is:
<plugin-features>
<package name="A1"></package><class
name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>;
plugin context.getassets (). open ("plugin.xml") is a program that parses the "plugin.xml" created under the asserts directory of the plug-in android package APK.
According to the embodiment of the invention, a program for describing the identity information of the plug-in android package APK is created in the plug-in android package APK according to a preset rule; under the condition that the main camera APK and the plug-in android package APK are communicated with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK, so that the program for describing the identity information of the plug-in android package APK is standardized, and the method has the advantages of simplicity, convenience, uniform format and the like.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a method for describing a plug-in installation package.
Referring to fig. 1, fig. 1 is a flowchart illustrating a first embodiment of a method for installing a plug-in package according to the present invention.
In a first embodiment, the method for describing a plug-in installation package comprises:
step 101, creating a program for describing identity information of the plug-in android package APK in the plug-in android package APK according to a preset rule;
the identity information at least comprises at least one or more than two of the name of the plug-in, the name of the class of the program describing the plug-in, the identification of whether a front camera of the mobile terminal supports the application program of the plug-in and the identification of whether the mobile terminal installs the application program of the plug-in.
Preferably, the program for creating, according to a preset rule, identity information describing plug-in android package APK in plug-in android package APK includes:
creating a program of 'plugin. xml' under an attributes directory of the plug-in android package APK;
xml is
<plugin-features>
<package name="A1"></package>
<class name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>
Wherein "A1" is the name of the plug-in; "a2" is the name of the class of the program of the plug-in, "mode-supported-front > true" ", which indicates that the front camera supports the plug-in, and" < mode-supported-local > true "", which indicates that the mobile terminal installs the application of the plug-in.
Specifically, assume that a program describing the identity information of a plug-in beauty camera is required.
The plug-in name of the plug-in beauty camera "can be described by" a1 ";
the name of the class of the program describing the identity information of the plug-in beauty camera may be described by "a 2".
The front camera of the mobile terminal supports the beauty camera and can be described by 'mode-supported-front > true'.
The mobile terminal locally installing the plug-in beauty camera can be described by < mode-supported-local > true </mode-supported-local >.
And 102, under the condition that the main camera APK and the plug-in android package APK are communicated with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK.
Preferably, when the main camera APK and the plug-in android package APK communicate with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK, including:
InputStreampluginXmlInput=pluginContext.getAssets().open("plugin.xml");
wherein, the 'plugin.xml' is:
<plugin-features>
<package name="A1"></package><class
name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>;
plugin context.getassets (). open ("plugin.xml") is a program that parses the "plugin.xml" created under the asserts directory of the plug-in android package APK.
Specifically, the plug-in is parsed by plug-in context (getactions (). open ("plug-in. xml"), the name of the plug-in is acquired according to "a1", the name of a class describing the program of the plug-in is acquired according to "a2", the plug-in is supported by a front camera of the mobile terminal is acquired according to "< mode-supported-front > -value-supported-front >", and the application program which has downloaded the plug-in locally on the mobile terminal is acquired according to "< mode-supported-local >".
Among them, a1 is "com.oppo.camera.common", and a2 is "common capmpode".
According to the embodiment of the invention, a program for describing the identity information of the plug-in android package APK is created in the plug-in android package APK according to a preset rule; under the condition that the main camera APK and the plug-in android package APK are communicated with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK, so that the program for describing the identity information of the plug-in android package APK is standardized, and the method has the advantages of simplicity, convenience, uniform format and the like.
Referring to fig. 2, fig. 2 is a flowchart illustrating a second embodiment of a method for installing a package by a plug-in according to the present invention.
On the basis of the first embodiment, after step 101, the method further includes:
and 103, storing the program in a preset directory of the plug-in android package APK.
Specifically, an xml capable of setting the identity information of the plug-in android package APK is created under the attributes directory of the plug-in android package APK, and the xml is named as plugin. APK is an abbreviation for Android Package, the Android installation Package.
When the plug-in android package APK is designed, the plug-in android package APK and the main Camera APK are in the same process, and the main Camera APK and the plug-in android package APK can be communicated with each other, so that each plug-in needs to describe own identity information according to a general design idea, wherein the identity information mainly comprises a package name and a class name of the plug-in android package APK, whether basic information is supported by the front and the back of the plug-in android package APK, and the like.
According to the embodiment of the invention, a program for describing the identity information of the plug-in android package APK is created in the plug-in android package APK according to a preset rule; under the condition that the main camera APK and the plug-in android package APK are communicated with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK, so that the program for describing the identity information of the plug-in android package APK is standardized, and the method has the advantages of simplicity, convenience, uniform format and the like.
The invention provides a mobile terminal.
Referring to fig. 3, fig. 3 is a functional module diagram of a mobile terminal according to a first embodiment of the present invention.
In a first embodiment, the mobile terminal includes:
a creating unit 301, configured to create, according to a preset rule, a program describing identity information of the plug-in android package APK in the plug-in android package APK;
the identity information at least comprises at least one or more than two of the name of the plug-in, the name of the class of the program describing the plug-in, the identification of whether a front camera of the mobile terminal supports the application program of the plug-in and the identification of whether the mobile terminal installs the application program of the plug-in.
Preferably, the creating unit 301 includes:
creating a program of 'plugin. xml' under an attributes directory of the plug-in android package APK;
xml is
<plugin-features>
<package name="com.oppo.camera.common"></package>
<class name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>
Wherein "A1" is the name of the plug-in; "a2" is the name of the class of the program of the plug-in, "mode-supported-front > true" ", which indicates that the front camera supports the plug-in, and" < mode-supported-local > true "", which indicates that the mobile terminal installs the application of the plug-in.
Specifically, assume that a program describing the identity information of a plug-in beauty camera is required.
The plug-in name of the plug-in beauty camera "can be described by" a1 ";
the name of the class of the program describing the identity information of the plug-in beauty camera may be described by "a 2".
The front camera of the mobile terminal supports the beauty camera and can be described by 'mode-supported-front > true'.
The mobile terminal locally installing the plug-in beauty camera can be described by < mode-supported-local > true </mode-supported-local >.
An obtaining unit 302, configured to, when the main camera APK and the plug-in android package APK communicate with each other, the main camera APK analyzes the program, and obtains identity information of the plug-in android package APK.
Preferably, the acquiring unit includes:
InputStreampluginXmlInput=pluginContext.getAssets().open("plugin.xml");
wherein, the 'plugin.xml' is:
<plugin-features>
<package name="A1"></package>
<class name="A2">common</class>
<mode-supporeted-front>true</mode-supporeted-front>
<mode-supporeted-local>true</mode-supporeted-local>
</plugin-features>;
plugin context.getassets (). open ("plugin.xml") is a program that parses the "plugin.xml" created under the asserts directory of the plug-in android package APK.
Specifically, the plug-in is parsed by plug-in context (getactions (). open ("plug-in. xml"), the name of the plug-in is acquired according to "a1", the name of a class describing the program of the plug-in is acquired according to "a2", the plug-in is supported by a front camera of the mobile terminal is acquired according to "< mode-supported-front > -value-supported-front >", and the application program which has downloaded the plug-in locally on the mobile terminal is acquired according to "< mode-supported-local >".
Referring to fig. 4, fig. 4 is a functional module diagram of a mobile terminal according to a second embodiment of the present invention.
On the basis of the first embodiment, the mobile terminal further includes:
and the storage unit 303 is configured to store the program in a preset directory of the plug-in android package APK.
Specifically, an xml capable of setting the identity information of the plug-in android package APK is created under the attributes directory of the plug-in android package APK, and the xml is named as plugin. APK is an abbreviation for Android Package, the Android installation Package.
When the plug-in android package APK is designed, the plug-in android package APK and the main Camera APK are in the same process, and the main Camera APK and the plug-in android package APK can be communicated with each other, so that each plug-in needs to describe own identity information according to a general design idea, wherein the identity information mainly comprises a package name and a class name of the plug-in android package APK, whether basic information is supported by the front and the back of the plug-in android package APK, and the like.
According to the embodiment of the invention, a program for describing the identity information of the plug-in android package APK is created in the plug-in android package APK according to a preset rule; under the condition that the main camera APK and the plug-in android package APK are communicated with each other, the main camera APK analyzes the program and acquires the identity information of the plug-in android package APK, so that the program for describing the identity information of the plug-in android package APK is standardized, and the method has the advantages of simplicity, convenience, uniform format and the like.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.