Plug-in calling method and device, electronic equipment and computer readable storage medium
By receiving plug-in identification requests in the Android system and querying plug-in data or interfaces in the database, and directly executing plug-in calls, the performance problems caused by frequent use of reflection in the prior art are solved, and the performance and stability of terminal devices are improved.
Patent Information
- Application Number
- CN202510046946.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-05-23
AI Technical Summary
Existing Android plug-in calling methods require frequent use of reflection, which affects the system's runtime performance.
By receiving the plug-in identification request from the requesting end, querying the corresponding plug-in data or interface of the plug-in identification in the preset database, and performing plug-in calls based on the query results, simplifying the plug-in loading and calling process.
Improves the performance and stability of the terminal device and reduces the performance loss caused by reflective calls.
Smart Images

Figure CN120029732A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a plug-in calling method, device, electronic device, and computer-readable storage medium. Background Art
[0002] In the Android system, the functional modules of an application can be packaged into independent plug-ins. Plug-ins usually consist of one or more classes and are integrated into the main application (also called the host application) through dynamic loading and unloading. This technology is called Android plug-inization, which enables the application to load the required functional modules on demand at runtime, improving the flexibility and scalability of the application.
[0003] In the prior art, Android plug-in is implemented based on Java's class loading mechanism, which mainly reads the bytecode of one or more classes in the plug-in through the class loader (ClassLoader) combined with the parent delegation mechanism, completes the loading of the corresponding class method, waits for the loading to be completed, and then calls the class method in the plug-in through reflection, thereby realizing the call of the plug-in.
[0004] However, the existing calling method requires frequent plug-in calls through reflection methods, which will seriously affect the performance of the Android system during runtime. Summary of the invention
[0005] The embodiments of the present application provide a plug-in calling method, device, electronic device and computer-readable storage medium, which can query the relevant content of a pre-stored target plug-in according to a request, and complete the plug-in call according to the relevant content of the target plug-in, thereby simplifying the plug-in loading and calling process and improving the performance and stability of the terminal device.
[0006] In a first aspect, an embodiment of the present application provides a plug-in calling method, which is applied to a terminal device, and the method includes:
[0007] Receiving a first request from a requesting end, the first request including at least one plug-in identifier, the first request being used to request to call a target plug-in;
[0008] According to the first request, querying a query result corresponding to the plug-in identifier in a preset database, wherein the query result includes at least one of the following: plug-in data or a plug-in interface, wherein the plug-in data is data after the target plug-in completes plug-in loading, and the plug-in interface is a communication interface of the target plug-in;
[0009] The plug-in call is executed according to the query result.
[0010] Optionally, in some embodiments of the present application, before receiving the first request from the requesting end, the method further includes:
[0011] receiving a second request from the called end, where the second request is used to request registration of the plug-in interface of the target plug-in;
[0012] According to the second request, the plug-in interface is generated and stored in the database.
[0013] Optionally, in some embodiments of the present application, querying a preset database for a query result corresponding to the plug-in identifier according to the first request includes:
[0014] Determining that the first request is a first request type, where the first request type is used to indicate that the requesting end requests to call the target plug-in for the first time;
[0015] Querying the database for the plug-in interface corresponding to the plug-in identifier;
[0016] The plug-in interface is determined to be the query result.
[0017] Optionally, in some embodiments of the present application, executing the plug-in call according to the query result includes:
[0018] Requesting the called end to load the plug-in data corresponding to the target plug-in according to the plug-in interface;
[0019] The requesting end is requested to execute a plug-in call according to the plug-in data.
[0020] Optionally, in some embodiments of the present application, after requesting the called end to load the plug-in data corresponding to the target plug-in according to the plug-in interface, the method further includes:
[0021] The plug-in data corresponding to the loaded target plug-in is stored in the database.
[0022] Optionally, in some embodiments of the present application, querying a preset database for a query result corresponding to the plug-in identifier according to the first request further includes:
[0023] Determining that the first request is a second request type, where the second request type is used to indicate that it is not the first time that the requesting end requests to call the target plug-in;
[0024] Querying the database for the plug-in data corresponding to the plug-in identifier;
[0025] The plug-in data is determined to be the query result.
[0026] Optionally, in some embodiments of the present application, executing the plug-in call according to the query result includes:
[0027] The requesting end is requested to execute a plug-in call according to the plug-in data.
[0028] In a second aspect, an embodiment of the present application further provides a plug-in calling device, which is applied to a terminal device, and the device includes:
[0029] A receiving module, configured to receive a first request from a requesting end, wherein the first request includes at least one plug-in identifier and is used to request to call a target plug-in;
[0030] A processing module, configured to query a query result corresponding to the plug-in identifier in a preset database according to the first request, wherein the query result includes at least one of the following: plug-in data or a plug-in interface, wherein the plug-in data is data after the target plug-in completes plug-in loading, and the plug-in interface is a communication interface of the target plug-in;
[0031] The processing module is further used to execute plug-in calling according to the query result.
[0032] Optionally, in some embodiments of the present application, the receiving module is used to:
[0033] receiving a second request from the called end, where the second request is used to request registration of the plug-in interface of the target plug-in;
[0034] According to the second request, the plug-in interface is generated and stored in the database.
[0035] Optionally, in some embodiments of the present application, the processing module is used to:
[0036] Determining that the first request is a first request type, where the first request type is used to indicate that the requesting end requests to call the target plug-in for the first time;
[0037] Querying the database for the plug-in interface corresponding to the plug-in identifier;
[0038] The plug-in interface is determined to be the query result.
[0039] Optionally, in some embodiments of the present application, the processing module is used to:
[0040] Requesting the called end to load the plug-in data corresponding to the target plug-in according to the plug-in interface;
[0041] The requesting end is requested to execute a plug-in call according to the plug-in data.
[0042] Optionally, in some embodiments of the present application, the processing module is used to:
[0043] The plug-in data corresponding to the loaded target plug-in is stored in the database.
[0044] Optionally, in some embodiments of the present application, the processing module is used to:
[0045] Determining that the first request is a second request type, where the second request type is used to indicate that it is not the first time that the requesting end requests to call the target plug-in;
[0046] Querying the database for the plug-in data corresponding to the plug-in identifier;
[0047] The plug-in data is determined to be the query result.
[0048] Optionally, in some embodiments of the present application, the processing module is used to:
[0049] The requesting end is requested to execute a plug-in call according to the plug-in data.
[0050] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps in the above-mentioned plug-in calling method when executed by the processor.
[0051] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned plug-in calling method are implemented.
[0052] In a fifth aspect, the embodiments of the present application further provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations described in the embodiments of the present application.
[0053] In summary, in an embodiment of the present application, a terminal device receives a first request from a requesting end; then, according to the first request, a query result corresponding to the plug-in identifier is queried in a preset database; and then, a technical solution for executing the plug-in call is implemented according to the query result. The first request includes at least one plug-in identifier, and the first request is used to request the call of a target plug-in. The query result includes at least one of the following: plug-in data or a plug-in interface, the plug-in data is the data after the target plug-in completes the plug-in loading, and the plug-in interface is the communication interface of the target plug-in. This solution can query the relevant content of the pre-stored target plug-in according to the request, and complete the plug-in call according to the relevant content of the target plug-in, thereby achieving the technical effect of simplifying the plug-in loading and calling process and improving the performance and stability of the terminal device. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0055] Figure 1 It is a schematic diagram of the plug-in calling process in the prior art;
[0056] Figure 2 It is a scenario diagram of the plug-in calling method provided in an embodiment of the present application;
[0057] Figure 3 It is a schematic diagram of a scenario in which a terminal device according to an embodiment of the present application executes the plug-in calling method;
[0058] Figure 4 It is a schematic diagram of the plug-in calling system structure corresponding to the plug-in calling method provided in an embodiment of the present application;
[0059] Figure 5 This is a schematic diagram of the plug-in calling process corresponding to the plug-in calling method provided in the embodiment of the present application. Figure 1 ;
[0060] Figure 6 This is a schematic diagram of the plug-in calling process corresponding to the plug-in calling method provided in the embodiment of the present application. Figure 2 ;
[0061] Figure 7 It is a structural diagram of a plug-in calling device provided in an embodiment of the present application;
[0062] Figure 8 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0064] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the above features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0065] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.
[0066] First, the terms involved in this application are explained:
[0067] Host application: referred to as host. In the plug-in architecture, the main application responsible for calling the plug-in class can be understood as the application installed from the application market.
[0068] Plugin: In the plugin architecture, a functional module called by the host application. A plugin usually consists of one or more classes. It is often loaded dynamically after the host is running.
[0069] Class: It is the basic building block in object-oriented programming and defines the properties and behavior of an object. A class is a template for code and is used to create objects. In Java, a class is represented by a ".class" file, which contains the bytecode of the class.
[0070] Reflection: A mechanism in Java that allows you to dynamically call class methods or access class fields at runtime.
[0071] ClassLoader: Java class loader.
[0072] In the prior art, the functional modules or functional components of an application can be packaged as independent plug-ins, and when the application needs to use related components or functions, the bytecode of one or more classes in the plug-in can be read through the class loader (ClassLoader) in combination with the parent delegation mechanism, and the plug-in call can be implemented after the class loading is completed. The technology of plug-inizing functional modules or functional components can increase the loading speed of the application, reduce the installation volume of the application, and bring a better experience for users to install and use. At the same time, plug-inization can also realize hot repair technology, with the ability to quickly repair online vulnerabilities (bugs) and online updates, thereby reducing the frequency of users updating compressed packages (APK) and avoiding the system running on the terminal device prompting users to update the version too frequently.
[0073] Specifically, most class loaders have a parent ClassLoader. When an application or requester tries to load a class, the ClassLoader will first try to let its parent ClassLoader load the class, that is, the parent delegation mechanism. In actual applications, an application or requester can create a new ClassLoader to load classes in a plug-in. The parent ClassLoader of the newly created ClassLoader is the ClassLoader of the host application. Therefore, classes in the plug-in can access classes in the host application, but classes in the host application cannot directly access classes in the plug-in, such as Figure 1 As shown in the plug-in call process diagram, after the host application initiates a class call request, it first determines whether the called class is in the host application. If so, it can directly initiate loading and call. If not, it is necessary to determine whether the called class is in the plug-in. If so, it can load and call the class in the plug-in through reflection. If not, it is necessary to initiate an asynchronous method to load the method of the corresponding class (at this time, there can be no time-consuming operations in the main thread), wait for the class method to be loaded, and then call the class method in the plug-in through reflection.
[0074] Therefore, the existing plug-in calling method has reflection every time the plug-in is called. The frequent use of reflection will affect the performance of the system. Moreover, when a large number of classes in plug-ins are called (in asynchronous mode), it is necessary to increase the thread switching cost, resulting in the occupation of CPU and memory resources. In addition, in some systems, the host application needs to record whether the called class is a class in the host or the plug-in, so as to facilitate the next call. There may be a lot of redundant judgments, which is not conducive to code maintenance.
[0075] Therefore, the plug-in calling method in the prior art has a technical problem of affecting the system runtime performance of the terminal device, which will directly affect the user's experience.
[0076] The embodiment of the present application provides a plug-in calling method, device, electronic device and computer-readable storage medium. The method adopts a technical solution of receiving a first request from a request end, the first request includes at least one plug-in identifier, and the first request is used to request to call a target plug-in; according to the first request, querying a query result corresponding to the plug-in identifier in a preset database, and the query result includes at least one of the following: plug-in data or plug-in interface, the plug-in data is the data after the target plug-in completes plug-in loading, and the plug-in interface is the communication interface of the target plug-in; and executing the plug-in calling according to the query result.
[0077] In summary, the plug-in calling method in the embodiment of the present application can query the relevant content of the pre-stored target plug-in according to the request, and complete the plug-in call according to the relevant content of the target plug-in, thereby achieving the technical effect of simplifying the plug-in loading and calling process and improving the performance and stability of the terminal device.
[0078] It should be noted that the order of description of the following embodiments is not intended to limit the priority order of the embodiments.
[0079] See also Figure 2 , Figure 2 The following is a scenario diagram of the plug-in calling method provided in the embodiment of the present application. The plug-in calling system may include a terminal device 100 and a processor 801. The terminal device 100 and the processor 801 may be connected to each other in any manner, including but not limited to signal communication through electronic circuits, communication through wireless signals, and the wireless signals may be computer network communications of the TCP / IP Protocol Suite (TCP / IP) and the User Datagram Protocol (UDP). The terminal device 100 may receive control signals from a remote control or a control panel, and the terminal device 100 may also receive instruction information sent by the processor 801. The terminal device 100 may perform corresponding operations according to the corresponding instruction information, such as the method for obtaining jamming data in the present application.
[0080] In the embodiment of the present application, the terminal device 100 includes but is not limited to a television, a mobile phone, a tablet, a computer, etc.
[0081] Those skilled in the art will understand that Figure 2 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 2 More or fewer terminal devices as shown in, e.g. Figure 2 Only one terminal device is shown, and no specific limitation is given here.
[0082] In addition, if Figure 2As shown, the processor 801 may include any hardware device capable of performing data processing and instruction sending, such as a CPU or a single-chip microcomputer embedded in the terminal device, and the specific details are not limited here.
[0083] It should be noted that Figure 2 The scenario diagram of the jam data acquisition system shown is merely an example. The jam data acquisition system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the jam data acquisition system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0084] For details, please refer to Figure 3 , Figure 3 : is a schematic diagram of a scenario in which a terminal device executes the plug-in calling method provided in an embodiment of the present application, wherein the specific execution process of the terminal device executing the plug-in calling method is as follows:
[0085] S301: Receive a first request from a requesting end.
[0086] In the embodiments of the present application, Figure 4 The plug-in calling system structure diagram shown in the figure, the execution subject of the plug-in calling method provided in the embodiment of the present application is the central service framework, and the central service framework can be run in the above-mentioned terminal device or the above-mentioned processor. The central service framework can also be run in the cloud server that communicates with the terminal device, which is not specifically limited in the embodiment of the present application. The central service framework can also process thread switching operations through a unified thread management module, for example: controlling the main thread to be responsible for application startup, controlling the child thread to be responsible for plug-in loading, etc.
[0087] Specifically, when a requesting end (also referred to as a caller or calling end), for example, a host application (also referred to as an application or application program) sends a call request to the central service framework through a service interface, the central service framework determines the plug-in that the call request wants to call based on pre-stored, registered plug-ins or other host applications (there may be multiple plug-ins in the host application), and can obtain the class in the plug-in that the call request wants to call through dynamic loading, and forward the loaded class to the host application that sent the call request, thereby completing the plug-in call.
[0088] It should be noted that the requesting end can send one or more requests to request the calling of one or more plug-ins. Therefore, the first request can be one or more. The first request is used to request the calling of the target plug-in. The first request can also include at least one plug-in identifier. The central service box can determine the plug-in that the calling request wants to call based on the plug-in identifier.
[0089] Before receiving the first request from the requesting end, optionally, the plug-in calling method provided in the embodiment of the present application further includes: receiving a second request from the called end; and generating a plug-in interface according to the second request and storing it in a database.
[0090] In the embodiment of the present application, the object of the called plug-in, that is, the called end (also referred to as the called party), can be the plug-in itself or other host applications. Figure 4 As shown, the called party includes host A, plug-in A and plug-in B. The called party can send a registration request (i.e., a second request for requesting to register the plug-in interface of the target plug-in) to the central service framework to register the plug-in interface of its own plug-in. During registration, the called party can send the plug-in identifier of its own plug-in to the central service framework so that it can be called later according to the plug-in identifier of the call request. The central service framework can generate a plug-in interface for the corresponding plug-in of the called party according to the plug-in identifier and store it in the database.
[0091] Specifically, the plug-in provider, that is, the called end (which can be the host or the plug-in), can register the service to the central service framework through the service registration module, inform and provide the plug-in's functional interface and plug-in identifier; the central service framework generates a service API, that is, the plug-in interface, based on the provided functional interface and plug-in identifier.
[0092] It should be noted that host A, plug-in A and plug-in B are only examples. In actual applications, the called ends may be more or less and are not limited to the host application and plug-ins.
[0093] S302: According to the first request, query a preset database for a query result corresponding to the plug-in identifier.
[0094] In an embodiment of the present application, the central service framework identifies the first request of the requesting end, determines the target plug-in corresponding to the plug-in identifier of the first request, and obtains relevant information of the target plug-in in the database to determine the query result.
[0095] Specifically, the query result includes at least one of the following: plug-in data or a plug-in interface, the plug-in data is the data after the target plug-in is loaded, and the plug-in interface is the communication interface of the target plug-in.
[0096] Optionally, the plug-in calling method provided in the embodiment of the present application also includes: determining that the first request is a first request type, the first request type is used to characterize the first request by the requesting end to call the target plug-in; querying the plug-in interface corresponding to the plug-in identifier in the database; and determining the plug-in interface as the query result.
[0097] In the embodiment of the present application, if the central service framework identifies that the first request of the requesting end is the first request to call the target plug-in (the requesting end has never called the target plug-in), that is, the first request type. Accordingly, it can be determined that the central service framework does not store the loading record and calling record of the corresponding class in the target plug-in. At this time, the central service framework can determine the plug-in interface of the target plug-in according to the plug-in identifier, and use the plug-in interface as the query result to complete the subsequent call of the target plug-in.
[0098] Optionally, the plug-in calling method provided in the embodiment of the present application also includes: determining that the first request is a second request type, the second request type is used to characterize that the requesting end is not requesting to call the target plug-in for the first time; querying the plug-in data corresponding to the plug-in identifier in the database; and determining that the plug-in data is the query result.
[0099] In the embodiment of the present application, if the central service framework identifies that the first request of the requesting end is not the first request to call the target plug-in (the requesting end has called the target plug-in before), that is, the second request type. Accordingly, it can be determined that the central service framework stores the loading record and calling record of the corresponding class in the target plug-in. At this time, the central service framework can determine the loading record of the target plug-in in the database according to the plug-in identifier, and obtain the plug-in data corresponding to the loading record, and use the plug-in data as the query result to complete the subsequent call of the target plug-in.
[0100] S303: Execute plug-in call according to the query result.
[0101] In the embodiments of the present application, Figure 5 The plug-in calling process shown Figure 1 When the central service framework determines the plug-in interface corresponding to the first request type, it initiates reflection dynamic loading of plug-in data according to the plug-in interface, and forwards the plug-in data to the requesting end so that the requesting end runs the plug-in data to complete the plug-in call, and then obtains the plug-in service corresponding to the target plug-in.
[0102] After the called end loads the plug-in data corresponding to the target plug-in according to the plug-in interface request, optionally, the plug-in calling method provided in the embodiment of the present application further includes: storing the plug-in data corresponding to the loaded target plug-in in a database.
[0103] In an embodiment of the present application, after the central service framework initiates reflection and dynamically loads the plug-in data according to the plug-in interface, it can generate a bound proxy class to record the result of this service call and store the proxy class in a database.
[0104] It should be noted that the proxy class can be used to store the plugin data corresponding to the loaded target plugin, and multiple proxy classes can be stored in the database. When the first request is received next time, if the proxy class of the target plugin corresponding to the plugin identifier exists in the database, the plugin data can be directly returned from the proxy class without initiating reflection again.
[0105] Optionally, the plug-in calling method provided in the embodiment of the present application further includes: requesting the called end to load plug-in data corresponding to the target plug-in according to the plug-in interface; and requesting the requesting end to execute the plug-in call according to the plug-in data.
[0106] In the embodiment of the present application, if the proxy class of the target plug-in corresponding to the plug-in identifier does not exist in the database, reflection can be directly initiated according to the plug-in interface to dynamically load the plug-in data of the target plug-in. At the same time, a proxy class is generated to record the plug-in data and the call result.
[0107] In the embodiments of the present application, Figure 6 The plug-in calling process shown Figure 2 When the central service framework determines the plug-in data corresponding to the second request type, it forwards the plug-in data to the requesting end so that the requesting end runs the plug-in data to complete the plug-in call and obtains the plug-in service corresponding to the target plug-in.
[0108] Optionally, the plug-in calling method provided in the embodiment of the present application further includes: requesting the requesting end to execute the plug-in calling according to the plug-in data.
[0109] In an embodiment of the present application, if there is a proxy class of the target plug-in corresponding to the plug-in identifier in the database, the plug-in data of the target plug-in can be directly obtained from the proxy class, and the plug-in data can be forwarded to the requesting end, and the requesting end is requested to execute the plug-in call.
[0110] Through the embodiment of the present application, the terminal device receives a first request from the requesting end; then, according to the first request, the query result corresponding to the plug-in identifier is queried in the preset database; and then, the technical solution of executing the plug-in call is implemented according to the query result. Among them, the first request includes at least one plug-in identifier, and the first request is used to request to call the target plug-in. Among them, the query result includes at least one of the following: plug-in data or plug-in interface, the plug-in data is the data after the target plug-in completes the plug-in loading, and the plug-in interface is the communication interface of the target plug-in. This solution can query the relevant content of the pre-stored target plug-in according to the request, and complete the plug-in call according to the relevant content of the target plug-in, thereby achieving the technical effect of simplifying the plug-in loading and calling process and improving the performance and stability of the terminal device.
[0111] In order to better implement the plug-in calling method of the present application, the present application also provides a plug-in calling device based on the above plug-in calling method. The meanings of the terms are the same as those in the above plug-in calling method, and the specific implementation details can refer to the description in the method embodiment.
[0112] See also Figure 7 , Figure 7 : is a schematic diagram of the structure of a plug-in calling device provided in an embodiment of the present application, wherein the plug-in calling device 700 is applied to a terminal device, and specifically can be as follows:
[0113] The receiving module 701 is used to receive a first request from a requesting end, the first request includes at least one plug-in identifier, and the first request is used to request to call a target plug-in;
[0114] The processing module 702 is used to query the query result corresponding to the plug-in identifier in the preset database according to the first request, and the query result includes at least one of the following: plug-in data or plug-in interface, the plug-in data is the data after the target plug-in completes the plug-in loading, and the plug-in interface is the communication interface of the target plug-in;
[0115] The processing module 702 is further used to execute the plug-in call according to the query result.
[0116] Optionally, in some embodiments of the present application, the receiving module 701 is used to:
[0117] receiving a second request from the called end, where the second request is used to request to register a plug-in interface of a target plug-in;
[0118] According to the second request, a plug-in interface is generated and stored in the database.
[0119] Optionally, in some embodiments of the present application, the processing module 702 is used to:
[0120] Determine that the first request is a first request type, where the first request type is used to indicate that the requesting end makes a first request to call a target plug-in;
[0121] Query the plug-in interface corresponding to the plug-in identifier in the database;
[0122] Determine the plugin interface as a query result.
[0123] Optionally, in some embodiments of the present application, the processing module 702 is used to:
[0124] According to the plug-in interface request, the called end loads the plug-in data corresponding to the target plug-in;
[0125] The request end is requested to execute the plug-in call according to the plug-in data.
[0126] Optionally, in some embodiments of the present application, the processing module 702 is used to:
[0127] The plugin data corresponding to the loaded target plugin is stored in the database.
[0128] Optionally, in some embodiments of the present application, the processing module 702 is used to:
[0129] Determine that the first request is a second request type, where the second request type is used to indicate that it is not the first request by the requesting end to call the target plug-in;
[0130] Query the plug-in data corresponding to the plug-in identifier in the database;
[0131] Determines the plugin data as a query result.
[0132] Optionally, in some embodiments of the present application, the processing module 702 is used to:
[0133] The request end is requested to execute the plug-in call according to the plug-in data.
[0134] In the embodiment of the present application, the receiving module 701 first receives a first request from the requesting end, the first request includes at least one plug-in identifier, and the first request is used to request to call the target plug-in. Then, the processing module 702 queries the query result corresponding to the plug-in identifier in a preset database according to the first request, and the query result includes at least one of the following: plug-in data or a plug-in interface. The plug-in data is the data of the target plug-in after the plug-in is loaded, and the plug-in interface is the communication interface of the target plug-in. Subsequently, the processing module 702 executes the plug-in call according to the query result.
[0135] Among them, the embodiment of the present application receives a first request from a requesting end through a terminal device; then, according to the first request, queries the query result corresponding to the plug-in identifier in a preset database; and then, executes the technical solution of plug-in calling according to the query result. Among them, the first request includes at least one plug-in identifier, and the first request is used to request to call the target plug-in. Among them, the query result includes at least one of the following: plug-in data or plug-in interface, the plug-in data is the data after the target plug-in completes the plug-in loading, and the plug-in interface is the communication interface of the target plug-in. This solution can query the relevant content of the pre-stored target plug-in according to the request, and complete the plug-in call according to the relevant content of the target plug-in, thereby achieving the technical effect of simplifying the plug-in loading and calling process and improving the performance and stability of the terminal device.
[0136] In addition, the present application also provides an electronic device, such as Figure 8 As shown, it shows a schematic diagram of the structure of the electronic device involved in this application, specifically:
[0137] The electronic device may include components such as a processor 801 with one or more processing cores, a memory 802 with one or more computer-readable storage media, a power supply 803, and an input unit 804. Those skilled in the art will appreciate that Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0138] The processor 801 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 802 and calling data stored in the memory 802, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801.
[0139] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.
[0140] The electronic device also includes a power supply 803 for supplying power to each component. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 803 can also include any components such as one or more DC or AC power supplies, recharging systems, power supply device debugging circuits, power converters or inverters, and power status indicators.
[0141] The electronic device may further include an input unit 804, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0142] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 801 in the electronic device will load the executable file corresponding to the process of one or more application programs into the memory 802 according to the following instructions, and the processor 801 will run the application program stored in the memory 802, thereby implementing the steps in any plug-in calling method provided in the embodiments of the present application.
[0143] The embodiment of the present application receives a first request from a requesting end through a terminal device; then, according to the first request, queries the query result corresponding to the plug-in identifier in a preset database; and then, executes the technical solution of plug-in calling according to the query result. Among them, the first request includes at least one plug-in identifier, and the first request is used to request to call the target plug-in. Among them, the query result includes at least one of the following: plug-in data or plug-in interface, the plug-in data is the data after the target plug-in completes the plug-in loading, and the plug-in interface is the communication interface of the target plug-in. This solution can query the relevant content of the pre-stored target plug-in according to the request, and complete the plug-in call according to the relevant content of the target plug-in, thereby achieving the technical effect of simplifying the plug-in loading and calling process and improving the performance and stability of the terminal device.
[0144] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0145] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0146] To this end, the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any plug-in calling method provided in the present application.
[0147] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0148] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0149] Since the instructions stored in the computer-readable storage medium can execute the steps in any plug-in calling method provided in the present application, the beneficial effects that can be achieved by any plug-in calling method provided in the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0150] The above is a detailed introduction to a plug-in calling method, device, electronic device and computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A plug-in calling method, characterized in that: Applied to a terminal device, the method comprises: Receiving a first request from a requesting end, the first request including at least one plug-in identifier, the first request being used to request to call a target plug-in; According to the first request, querying a query result corresponding to the plug-in identifier in a preset database, wherein the query result includes at least one of the following: plug-in data or a plug-in interface, wherein the plug-in data is data after the target plug-in completes plug-in loading, and the plug-in interface is a communication interface of the target plug-in; The plug-in call is executed according to the query result.
2. The method according to claim 1, characterized in that Before receiving the first request from the requesting end, the method further includes: receiving a second request from the called end, where the second request is used to request registration of the plug-in interface of the target plug-in; According to the second request, the plug-in interface is generated and stored in the database.
3. The method according to claim 1, characterized in that The querying of a query result corresponding to the plug-in identifier in a preset database according to the first request includes: Determining that the first request is a first request type, where the first request type is used to indicate that the requesting end requests to call the target plug-in for the first time; Querying the database for the plug-in interface corresponding to the plug-in identifier; The plug-in interface is determined to be the query result.
4. The method according to claim 3, characterized in that The executing the plug-in call according to the query result includes: Requesting the called end to load the plug-in data corresponding to the target plug-in according to the plug-in interface; The requesting end is requested to execute a plug-in call according to the plug-in data.
5. The method according to claim 4, characterized in that After requesting the called end to load the plug-in data corresponding to the target plug-in according to the plug-in interface, the method further includes: The plug-in data corresponding to the loaded target plug-in is stored in the database.
6. The method according to claim 3, characterized in that The step of searching a preset database for a query result corresponding to the plug-in identifier according to the first request further includes: Determining that the first request is a second request type, where the second request type is used to indicate that it is not the first time that the requesting end requests to call the target plug-in; Querying the database for the plug-in data corresponding to the plug-in identifier; The plug-in data is determined to be the query result.
7. The method according to claim 6, characterized in that The executing the plug-in call according to the query result includes: The requesting end is requested to execute a plug-in call according to the plug-in data.
8. A plug-in calling device, characterized in that: Applied to a terminal device, the device comprises: A receiving module, configured to receive a first request from a requesting end, wherein the first request includes at least one plug-in identifier and is used to request to call a target plug-in; A processing module, configured to query a query result corresponding to the plug-in identifier in a preset database according to the first request, wherein the query result includes at least one of the following: plug-in data or a plug-in interface, wherein the plug-in data is data after the target plug-in completes plug-in loading, and the plug-in interface is a communication interface of the target plug-in; The processing module is further used to execute plug-in calling according to the query result.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the plug-in calling method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the plug-in calling method according to any one of claims 1 to 7 are implemented.