Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for calling functions among applications, and aims to solve the problems of failure in calling the functions among the applications and poor user experience.
In order to solve the above problems, the present invention provides a method for calling functions between applications, the method comprising:
Receiving an inter-application function call request sent by a first application, wherein the inter-application function call request comprises a second application and a function to be called;
Checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata set by the second application for the function to be called;
judging whether the first application supports the function to be called or not according to the metadata;
And if the first application supports the function to be called, the first application uses the function to be called according to the description document of the second application.
Preferably, the step of determining whether the first application supports the function to be invoked according to the metadata includes:
acquiring and analyzing metadata of the function to be called, and acquiring a plurality of target authorities required by calling the function to be called;
acquiring a plurality of actual rights possessed by the first application, and comparing the plurality of actual rights with the plurality of target rights;
If the plurality of actual authorities comprise the plurality of target authorities, judging that the first application supports the function to be called;
And if the plurality of actual authorities do not include one or more of the plurality of target authorities, judging that the first application does not support the function to be called.
Preferably, the step of checking whether the current device installs the second application, and if the current device installs the second application, reading and parsing metadata set by the second application for the function to be invoked further includes:
Judging whether the first application is the function to be called for calling the second application for the first time;
If the first application is the function to be called of the second application, executing the steps: checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata of the function to be called;
if the first application is not calling the function to be called of the second application for the first time, checking a calling record and judging whether the function to be called of the second application is successfully called;
if the function to be called of the second application is successfully called, executing the steps of: and the first application uses the function to be called according to the description document of the second application.
Preferably, the step of checking whether the second application is installed by the current device comprises:
Acquiring an application list of the current equipment, and comparing the specific name of the second application with a plurality of names in the application list;
And if the specific names of the second application are contained in the names in the application list, judging that the second application is installed in the current equipment.
Preferably, before the step of determining whether the first application supports the function to be invoked according to the metadata, the method further includes:
Acquiring and analyzing metadata of the function to be called, and judging whether the second application has interaction permission to interact with the first application;
If the second application has the interaction authority of interacting the function to be invoked with the first application, executing the steps: and judging whether the first application supports the function to be called or not according to the metadata.
Preferably, the step of determining whether the first application supports the function to be invoked according to the metadata further includes:
If the first application does not support the function to be called, outputting unsupported prompt information and acquiring current version information and latest version information of the first application;
comparing the current version information with the latest version information, and outputting version upgrading prompt information of the first application if the current version information of the first application is not the latest version information.
Preferably, the step of reading and parsing metadata set by the second application for the function to be called further includes:
acquiring a function list of the second application currently installed, and judging whether the second application has the function to be called or not according to the function list;
and if the second application does not have the function to be called, outputting prompt information without the function to be called and/or outputting version upgrading prompt information of the second application.
In addition, to achieve the above object, the present invention also provides an apparatus for inter-application function call, the apparatus comprising:
The receiving module is used for receiving an inter-application function call request sent by a first application, wherein the inter-application function call request comprises a second application and a function to be called;
The analysis module is used for checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata set by the second application for the function to be called;
The judging module is used for judging whether the first application supports the function to be called or not according to the metadata;
And the use module is used for using the function to be called by the first application according to the description document of the second application if the first application supports the function to be called.
In addition, in order to achieve the above object, the present invention also provides an inter-application function call device, where the inter-application function call device includes a processor, a memory, and an inter-application function call program stored in the memory, where the inter-application function call program is executed by the processor to implement the steps of the inter-application function call method as described above.
In addition, in order to achieve the above object, the present invention also provides a computer storage medium having stored thereon a program for inter-application function call, which when executed by a processor, implements the steps of the method for inter-application function call as described above.
Compared with the prior art, the invention discloses a method, a device, equipment and a storage medium for calling inter-application functions, which are used for receiving an inter-application function call request sent by a first application, wherein the inter-application function call request comprises a second application and a function to be called; checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata set by the second application for the function to be called; judging whether the first application supports the function to be called or not according to the metadata; and if the first application supports the function to be called, the first application uses the function to be called according to the description document of the second application. Therefore, when a first application needs to call a function to be called of a second application, whether the first application supports the function to be called or not is judged through metadata set for the function to be called by the second application, and the function to be called is used according to a description document, so that the success rate of interaction between applications is improved, and the problems of failure in function call between applications and poor user experience are solved.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The device for calling the inter-application functions mainly related to the embodiment of the invention refers to network connection equipment capable of realizing network connection, and the device for calling the inter-application functions can be network equipment such as a mobile terminal, a computer, an iPad and the like.
Referring to fig. 1, fig. 1 is a schematic hardware configuration diagram of an apparatus for inter-application function call according to various embodiments of the present invention. In an embodiment of the present invention, the devices for calling functions between applications may include a processor 1001 (e.g., a central processing unit Central Processing Unit, a CPU), a communication bus 1002, an input port 1003, an output port 1004, and a memory 1005. Wherein the communication bus 1002 is used to enable connected communications between these components; the input port 1003 is used for data input; the output port 1004 is used for data output, and the memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory, and the memory 1005 may be an optional storage device independent of the processor 1001. Those skilled in the art will appreciate that the hardware configuration shown in fig. 1 is not limiting of the invention and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
With continued reference to fig. 1, the memory 1005 of fig. 1, which is a readable storage medium, may include an operating system, a network communication module, an application program module, and a program for inter-application function calls. In fig. 1, the network communication module is mainly used for connecting with a server and performing data communication with the server; and the processor 1001 is used to call a program of the inter-application function call stored in the memory 1005 and execute the steps of the method of the inter-application function call.
The first embodiment of the present invention is presented based on the inter-application function calling device described above. Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a method for inter-application function call according to the present invention.
The embodiment provides a method for calling functions between applications, which comprises the following steps:
step S101: receiving an inter-application function call request sent by a first application, wherein the inter-application function call request comprises a second application and a function to be called;
When using a device such as a mobile phone, an iPad, or a computer that can perform inter-application function call, it is often necessary to call a function of another application from the currently running application. For example, when using shopping applications, the payment function of internet banking needs to be called, and when using WeChat, the video playing function to the player needs to be called. But in actual use, function call failure is often caused by restrictions of version, authority, and the like.
In this embodiment, the device for calling the inter-application function may perform man-machine interaction with a user, and when the user uses a first application that is currently active, the user may trigger an instruction for calling the inter-application function, and then the first application generates an inter-application function calling request according to the instruction for calling the application function. It will be appreciated that the inter-application function call request includes the second application and the function to be called. For example, when the shopping application is used, the payment function of the online banking is called, the first application is the shopping application, the second application is the online banking, and the function to be called is the payment function.
Step S102: checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata set by the second application for the function to be called;
There are many technical solutions currently available for checking whether a certain application is installed in a current device, for example, for a computer end, checking through codes: first, looking up the system registry, through Uninstall, traverse the installed applications HKEY_LOCAL_MACHINE\software\ Micrsosoft \Windows\current version\ Uninstall.
Specifically, the step S102 of checking whether the second application is installed by the current device includes:
Step S102a: acquiring an application list of the current equipment, and comparing the specific name of the second application with a plurality of names in the application list;
And acquiring and viewing an application list of the current equipment, wherein the application list at least comprises the names of installed applications, and can also comprise information such as icons, version numbers, update dates, use frequencies and the like. And after a plurality of names are acquired through the application list, comparing the specific name of the second application with the plurality of names in the application list.
Step S102b: and if the specific names of the second application are contained in the names in the application list, judging that the second application is installed in the current equipment.
And if one of the names of the application list is the same as the name of the second application, judging that the second application is installed by the current device.
Otherwise, if the names of the application list do not have the same names as the names of the second application, the current device is judged not to install the second application. And if the second application is not installed, outputting prompt information of the second application which is not installed.
And if the second application is installed in the current equipment, reading and analyzing metadata set by the second application for the function to be called. And when the second application updates or newly adds a certain external function, synchronously updating or newly adding metadata of the external function. For example, when an application newly adds an external function to an android system, metadata (metadata) of the function is newly added in an android management file of the application, a key and a value corresponding to the metadata are written in an external document of the android system, meanings of the key and the value are described, and a manner of calling the function (such as a starting manner, a parameter transferring manner and the like) can be also described. And after the android management xml is set, issuing an application compression package and an interface document for downloading, installing and using by a user.
Further, the step S102: checking whether the second application is installed on the current device, and if so, reading and analyzing metadata set by the second application for the function to be called further comprises:
Step S1020a: judging whether the first application is the function to be called for calling the second application for the first time;
inquiring the record of calling the second application by the first application according to the history calling record of the current equipment. And if the record of the to-be-called function of the second application called by the first application does not exist in the history calling record, the first application is described as the to-be-called function of the second application called for the first time. And if the record of the to-be-called function of the second application called by the first application exists in the history calling record, the first application is not the to-be-called function of the second application called for the first time. It will be appreciated that since the history call log will be cleared by the system or user, it is generally only possible to determine whether the history call log is the first call within the time frame in which it exists.
Step S1020b: if the first application is the function to be called of the second application, executing the steps: checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata of the function to be called;
if the first application is the function to be called of the second application, no history record is available, whether the second application is installed in the current device is needed to be checked, and if the second application is installed in the current device, the step of reading and analyzing metadata of the function to be called is needed to acquire related information.
Step S1020c: if the first application is not calling the function to be called of the second application for the first time, checking a calling record and judging whether the function to be called of the second application is successfully called;
If the first application is not calling the function to be called of the second application for the first time, judging whether the history calling is successful or not according to the checking calling record.
Step S1020d: if the function to be called of the second application is successfully called, executing the steps of: and the first application uses the function to be called according to the description document of the second application.
If the function to be called of the second application is not successfully called, executing the steps of: and checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing the metadata of the function to be called.
Therefore, under the condition that the history call record exists, metadata does not need to be checked, repeated work is reduced, and the processing efficiency of the call request is improved.
Step S103: judging whether the first application supports the function to be called or not according to the metadata;
generally, the metadata includes an application name, an application identifier, an activity of an application, a content provider, a broadcast, a service, an API (Application Programming Interface, an application program interface), a rights statement required for enabling the function by a corresponding application, a rights statement required for invoking the function by other applications, and the like. Based on this, whether the first application supports the function to be invoked may be enabled by the metadata.
Specifically, the step S103: according to the metadata, the step of judging whether the first application supports the function to be called comprises the following steps:
Step S103a: acquiring and analyzing metadata of the function to be called, and acquiring a plurality of target authorities required by calling the function to be called;
The metadata declares a plurality of target authorities required for calling the function to be called, so that the target authorities can be obtained by analyzing the metadata of the function to be called. It will be appreciated that the number of target rights may be one or more. For example, if the function to be invoked is to take a picture, the target authority may be to access a camera.
Step S103b: acquiring a plurality of actual rights possessed by the first application, and comparing the plurality of actual rights with the plurality of target rights;
and acquiring a plurality of actual rights possessed by the first application by querying a rights list of the first application. After the target authority and the actual authority are obtained, the actual authorities are compared with the target authorities
Step S103c: if the plurality of actual authorities comprise the plurality of target authorities, judging that the first application supports the function to be called;
and if the plurality of actual authorities comprise the plurality of target authorities, explaining that the first application has the condition of using the function to be called, and therefore judging that the first application supports the function to be called.
Step S103d: and if the plurality of actual authorities comprise one or more of the plurality of target authorities, judging that the first application does not support the function to be called.
If the plurality of actual rights include one or more of the plurality of target rights, the condition that the first application does not have the function to be called is indicated, and therefore the first application is determined not to support the function to be called.
And if the first application does not support the function to be called, outputting a prompt message which is not supported by the authority so as to grant the related authority.
Further, the step S103: according to the metadata, the step of judging whether the first application supports the function to be called further comprises the following steps:
step S1030: acquiring and analyzing metadata of the function to be called, and judging whether the second application has interaction permission to interact with the first application;
The metadata of the function to be called also comprises the authority required by the interaction of other applications. For example, the current WeChat and the payment treasure do not support interaction, so that the WeChat and the payment treasure have no interaction authority. For another example, when shopping is performed through the jingdong, payment can be performed through the WeChat, and the jingdong and the WeChat have interaction permission.
If the second application has the interaction authority of interacting the function to be invoked with the first application, executing the steps: and judging whether the first application supports the function to be called or not according to the metadata.
Otherwise, if the second application has the interaction authority for interacting the function to be invoked with the first application, outputting unsupported prompt information.
Step S104: and if the first application supports the function to be called, the first application uses the function to be called according to the description document of the second application.
If the first application supports the function to be called, further acquiring a description document of the second application, wherein the description document comprises a related description of the function to be called, so that the corresponding function to be called can be used according to the description document when the second application is called.
According to the scheme, the inter-application function calling request sent by the first application is received, and the inter-application function calling request comprises the second application and the function to be called; checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata set by the second application for the function to be called; judging whether the first application supports the function to be called or not according to the metadata; and if the first application supports the function to be called, the first application uses the function to be called according to the description document of the second application. Therefore, when a first application needs to call a function to be called of a second application, whether the first application supports the function to be called or not is judged through metadata set for the function to be called by the second application, and the function to be called is used according to a description document, so that the success rate of interaction between applications is improved, and the problems of failure in function call between applications and poor user experience are solved.
Based on the first embodiment shown in fig. 2, a second embodiment of the present invention is proposed, and referring to fig. 3, fig. 3 is a flow chart of the first embodiment of the method for inter-application function call of the present invention.
The step of judging whether the first application supports the function to be called according to the metadata further comprises the following steps:
step S1031: if the first application does not support the function to be called, outputting unsupported prompt information and acquiring current version information and latest version information of the first application;
And obtaining a plurality of target rights required by calling the function to be called according to the metadata of the function to be called, and obtaining a plurality of actual rights possessed by the first application by inquiring a rights list of the first application. After the target authority and the actual authority are obtained, the actual authorities are compared with the target authorities. If the plurality of actual rights include one or more of the plurality of target rights, the condition that the first application does not have the function to be called is indicated, and therefore the first application is determined not to support the function to be called. And if the first application does not support the function to be called, outputting unsupported prompt information, and acquiring current version information and latest version information of the first application. Referring to the current version information of the first application from the current device; and acquiring the latest version information of the first application from the broadcast of the first application.
Step S1032: comparing the current version information with the latest version information, and outputting version upgrading prompt information of the first application if the current version information of the first application is not the latest version information.
And comparing the current version information with the latest version information to judge whether the first application does not support the function to be called due to the fact that the version of the first application is too low. And if the current version information of the first application is not the latest version information, outputting version upgrading prompt information of the first application.
Therefore, under the condition that the first application does not support the function to be called, the reasons of the unsupported reasons are checked, and a corresponding solution is obtained. In this embodiment, if the first application version is too low and is not supported, version upgrade may be used to solve the problem.
Further, the step of reading and parsing metadata set by the second application for the function to be called further includes:
Step S1021: acquiring a function list of the second application currently installed, and judging whether the second application has the function to be called or not according to the function list;
It will be appreciated that if the function to be invoked is a function newly added by the second latest version, the second application of the old version does not configure the function to be invoked.
The embodiment obtains and checks the function list of the installed second application through codes, and obtains the functions of the installed second application. Comparing the function to be called with the functions in the function list, and if the function in the function list comprises the function to be called, judging that the second application has the function to be called; otherwise, if the function in the function list does not include the function to be called, the second application is judged to have no function to be called.
Step S1022: and if the second application does not have the function to be called, outputting prompt information without the function to be called and/or outputting version upgrading prompt information of the second application.
Generally, if the second application does not have the function to be called, the function to be called may be updated to the latest version because the function to be called is a new version function, so the second application on the current device needs to be updated to the latest version to use the function to be called.
In this embodiment, the current version information of the second application is compared with the latest version information, and if the current version information of the second application is not the latest version information, version upgrade prompt information of the second application is output. Therefore, the failure of inter-application function call caused by the fact that the second application is not updated in time can be solved.
Through the scheme, if the first application does not support the function to be called, outputting unsupported prompt information, and acquiring current version information and latest version information of the first application; comparing the current version information with the latest version information, and outputting version upgrading prompt information of the first application if the current version information of the first application is not the latest version information. Acquiring a function list of the second application currently installed, and judging whether the second application has the function to be called or not according to the function list; and if the second application does not have the function to be called, outputting prompt information without the function to be called and/or outputting version upgrading prompt information of the second application. Therefore, under the condition that the calling of the function to be called fails, version information of the first application and the second application is checked, the problem of failure in calling of the functions among the applications due to too low version is solved, the success rate of interaction among the applications is improved, and the problem of failure in calling of the functions among the applications and poor user experience is solved.
In addition, the embodiment of the invention also provides a device for calling the functions between the applications. Specifically, referring to fig. 4, fig. 4 is a functional block diagram of a first embodiment of an apparatus for inter-application function call according to the present invention, where the apparatus for inter-application function call includes:
A receiving module 10, configured to receive an inter-application function call request sent by a first application, where the inter-application function call request includes a second application and a function to be called;
the parsing module 20 is configured to check whether the second application is installed on the current device, and if the second application is installed on the current device, read and parse metadata set by the second application for the function to be invoked;
a judging module 30, configured to judge whether the first application supports the function to be invoked according to the metadata;
And a use module 40, configured to use, by the first application, the function to be invoked according to the description document of the second application if the first application supports the function to be invoked.
Further, the judging module includes:
the first acquisition unit is used for acquiring and analyzing the metadata of the function to be called and acquiring a plurality of target authorities required by calling the function to be called;
The second acquisition unit is used for acquiring a plurality of actual rights possessed by the first application and comparing the actual rights with the target rights;
The first judging unit is used for judging that the first application supports the function to be called if the plurality of actual authorities comprise the plurality of target authorities;
And the second judging unit is used for judging that the first application does not support the function to be called if the plurality of actual authorities do not comprise one or more of the plurality of target authorities.
Further, the parsing module further includes:
The first judging unit is used for judging whether the first application is the function to be called for calling the second application for the first time;
The first execution unit is configured to execute the steps if the first application is the function to be called that calls the second application for the first time: checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata of the function to be called;
the second judging unit is used for checking a calling record and judging whether the function to be called of the second application is successfully called if the first application is not calling the function to be called of the second application for the first time;
the second execution unit is configured to execute the steps if the function to be invoked of the second application has been successfully invoked, where: and the first application uses the function to be called according to the description document of the second application.
Further, the parsing module includes:
the comparison unit is used for acquiring an application list of the current equipment and comparing the specific name of the second application with a plurality of names in the application list;
and the third judging unit is used for judging that the second application is installed in the current equipment if the specific names of the second application are contained in the names in the application list.
Further, the judging module includes:
The third judging unit is used for acquiring and analyzing the metadata of the function to be called and judging whether the second application has the interaction authority for interacting the function to be called with the first application;
The third execution unit is configured to execute the steps if the second application has the interaction right to interact with the first application to perform the function to be invoked: and judging whether the first application supports the function to be called or not according to the metadata.
Further, the judging module further includes:
The first output unit is used for outputting unsupported prompt information and acquiring current version information and latest version information of the first application if the first application does not support the function to be called;
and the second output unit is used for comparing the current version information with the latest version information, and outputting version upgrading prompt information of the first application if the current version information of the first application is not the latest version information.
Further, the parsing module further includes:
A fourth judging unit, configured to obtain a function list of the second application currently installed, and judge whether the second application has the function to be called according to the function list;
And the third output unit is used for outputting prompt information without the function to be called and/or outputting version upgrading prompt information of the second application if the second application does not have the function to be called.
In addition, the embodiment of the present invention further provides a computer storage medium, where a program for calling an inter-application function is stored in the computer storage medium, and the steps of the method for calling an inter-application function are implemented when the program for calling an inter-application function is run by a processor, which are not described herein.
Compared with the prior art, the method, the device, the equipment and the storage medium for calling the inter-application functions are provided, and the inter-application function calling request sent by the first application is received, wherein the inter-application function calling request comprises the second application and the function to be called; checking whether the second application is installed on the current equipment, and if the second application is installed on the current equipment, reading and analyzing metadata set by the second application for the function to be called; judging whether the first application supports the function to be called or not according to the metadata; and if the first application supports the function to be called, the first application uses the function to be called according to the description document of the second application. Therefore, when a first application needs to call a function to be called of a second application, whether the first application supports the function to be called or not is judged through metadata set for the function to be called by the second application, and the function to be called is used according to a description document, so that the success rate of interaction between applications is improved, and the problems of failure in function call between applications and poor user experience are solved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising several instructions for causing a terminal device to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or modifications in the structures or processes described in the specification and drawings, or the direct or indirect application of the present invention to other related technical fields, are included in the scope of the present invention.