Software development kit calling method, device, computer equipment and storage medium
Through the adapter, the SDK is called uniformly in different host environments, which solves the problem of low development efficiency caused by different SDK calling APIs in different host environments, and realizes efficient SDK calling.
Patent Information
- Application Number
- CN202110196445.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-22
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-02-22
AI Technical Summary
The calling APIs of SDKs in different host environments are different, which causes the same application to call the same function SDKs in different host environments to use different APIs, resulting in low development efficiency.
Receive the call instructions sent by the target application through the call interface provided by the adapter, and determine the target environment category to which the host of the target application belongs. If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, then A dedicated interface call dedicated toolkit corresponding to the target environment category.
It realizes unified call to SDK in different host environments, improves development efficiency and reduces the complexity of developers in handling different APIs.
Smart Images

Figure CN112860457B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of programming technology, and in particular to a method, device, computer equipment and storage medium for calling a software development toolkit. Background Art
[0002] With the development of computer technology, SDK (Software Development Kit) has emerged. SDK is a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc. It contains relevant documents, examples and tools to assist in the development of a certain type of software.
[0003] The host environment is the software environment in which the software survives in the computer environment. The host environment contains SDKs that encapsulate various basic functions. Various applications such as Alipay and WeChat, as well as public accounts, mini-programs, and quick applications can call the functions encapsulated in the SDK through the API (Application Programming Interface), which can effectively reduce the workload of software development.
[0004] However, the calling APIs of SDKs in different host environments are different. The same application needs to use different APIs to call the SDKs with the same function in different host environments, which reduces the development efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide a software development toolkit calling method, device, computer equipment and storage medium that can improve development efficiency in response to the above technical problems.
[0006] A method for calling a software development tool kit, the method comprising:
[0007] Receiving a call instruction sent by a target application through a call interface provided by the adapter, wherein the call interface is used to communicate instructions with applications running in hosts of various environment categories, and the call instruction carries target toolkit information;
[0008] Determining, according to the calling instruction, a target environment category to which the host where the target application is located belongs;
[0009] If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the dedicated toolkit is called through a dedicated interface corresponding to the target environment category, and the dedicated toolkit is a toolkit dedicated to the application in the host of the target environment category;
[0010] When the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application.
[0011] In one embodiment, determining the target environment category of the host where the target application is located according to the calling instruction includes:
[0012] According to the calling instruction, obtaining user agent information of the host where the target application is located;
[0013] Obtaining an identifier of a host where the target application is located from the user agent information;
[0014] According to the identifier of the host where the target application is located, the target environment category to which the host where the target application is located belongs is determined.
[0015] In one embodiment, the method further comprises:
[0016] Searching for a dedicated toolkit corresponding to the target toolkit information in a list of toolkits provided to hosts of the target environment category;
[0017] If the dedicated toolkit is found, determining that the host of the target environment category is configured with the dedicated toolkit;
[0018] If the dedicated toolkit cannot be found in the search, it is determined that the host of the target environment category is not configured with the dedicated toolkit.
[0019] In one embodiment, the method further comprises:
[0020] Before calling the dedicated toolkit through the dedicated interface corresponding to the target environment category, the dedicated interface corresponding to the target environment category is obtained from the list.
[0021] In one embodiment, the method further comprises:
[0022] If the host of the target environment category is not configured with the dedicated toolkit, a universal toolkit is called through a universal interface, wherein the universal toolkit is a toolkit common to application programs in hosts of various application environment categories;
[0023] When the general toolkit is successfully called, the calling result of the general toolkit is returned to the target application.
[0024] In one embodiment, the method further comprises:
[0025] If the dedicated toolkit call fails, or the general toolkit call fails, an error message is returned to the target application.
[0026] In one of the embodiments, the calling instruction is an instruction triggered and generated after the target application has loaded all toolkits configured in the host where the target application is located.
[0027] A software development kit calling device, the device comprising:
[0028] A receiving module, used to receive a calling instruction sent by a target application through a calling interface provided by the adapter, wherein the calling interface is used to communicate instructions with applications running in hosts of various environment categories, and the calling instruction carries target toolkit information;
[0029] A determination module, used to determine the target environment category to which the host where the target application is located belongs according to the calling instruction;
[0030] a calling module, configured to call the dedicated toolkit corresponding to the target toolkit information through a dedicated interface corresponding to the target environment category if the host of the target environment category is configured with the dedicated toolkit, wherein the dedicated toolkit is a toolkit dedicated to an application in the host of the target environment category;
[0031] The return module is used to return the calling result of the dedicated toolkit to the target application when the calling of the dedicated toolkit is successful.
[0032] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Receiving a call instruction sent by a target application through a call interface provided by the adapter, wherein the call interface is used to communicate instructions with applications running in hosts of various environment categories, and the call instruction carries target toolkit information;
[0034] Determining, according to the calling instruction, a target environment category to which the host where the target application is located belongs;
[0035] If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the dedicated toolkit is called through a dedicated interface corresponding to the target environment category, and the dedicated toolkit is a toolkit dedicated to the application in the host of the target environment category;
[0036] When the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application.
[0037] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0038] Receiving a call instruction sent by a target application program through a call interface provided by the adapter, wherein the call interface is used to communicate instructions with hosts of various application environment categories, and the call instruction carries target toolkit information;
[0039] Determining, according to the calling instruction, a target environment category to which the host where the target application is located belongs;
[0040] If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the dedicated toolkit is called through a dedicated interface corresponding to the target environment category, and the dedicated toolkit is a toolkit dedicated to the application in the host of the target environment category;
[0041] When the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application.
[0042] The above-mentioned software development toolkit calling method, device, computer equipment and storage medium provide a calling interface through an adapter, and the calling interface is used to communicate instructions with applications running in hosts of various environment categories, and the target application can send a calling instruction to the adapter. The calling instruction carries the target toolkit information, and the target application can call the target toolkit through the adapter. The adapter receives the calling instruction sent by the target application through the calling interface, and can use the calling instruction as a trigger signal to determine the target environment category to which the host where the target application is located belongs. If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the adapter can call the dedicated dedicated toolkit of the application in the host of this environment category through the dedicated interface corresponding to the environment category, and when the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application. The whole process is mainly completed by the adapter, and the target application only needs to send a calling instruction to the adapter to receive the calling result returned by the adapter. Since the calling interface of the adapter that receives calling instructions is used to communicate instructions with applications running in hosts of various environment categories, it is unrelated to the environment category to which the host where the target application is located belongs. Therefore, applications running in hosts of different environment categories can send calling instructions to the unified calling interface and use the adapter to call the target toolkit, thereby effectively improving development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 An application environment diagram of a software development kit calling method in one embodiment;
[0044] Figure 2 A schematic diagram of a process of calling a software development kit in one embodiment;
[0045] Figure 3 A structural block diagram of a software development kit calling device in one embodiment;
[0046] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] The software development kit calling method provided in this application can be applied to Figure 1 In the application environment shown in FIG. 1 , hosts 102 of different environment categories are configured with the same dedicated toolkit 104, such as an SDK for obtaining location information, an SDK for taking photos, an SDK for selecting videos, an SDK for setting page titles, etc. The calling interface of the same dedicated toolkit 104 in hosts 102 of different environment categories is different, such as the SDK for obtaining location information is called through different APIs in an iOS system and an Android system.
[0049] The same application 106 is running in hosts 102 of different environment categories, such as CMB Financial APP, Alipay APP, WeChat APP, etc., running in both iOS and Android systems. The same application 106 in hosts 102 of different environment categories calls the same dedicated toolkit 104 configured in the host 102 through the adapter 108.
[0050] Specifically, the adapter is provided with a calling interface, which is used to communicate instructions with applications running in hosts of various environment categories. The target application can call the adapter through the calling interface and send a calling instruction to the adapter, which carries the target toolkit information. The adapter receives the calling instruction sent by the target application through the calling interface, and determines the target environment category to which the host where the target application is located belongs according to the calling instruction. If the host of the target environment category is configured with a special toolkit corresponding to the target toolkit information, the adapter calls the special toolkit through the special interface corresponding to the target environment category, and the special toolkit is a toolkit dedicated to the application in the host of the target environment category. When the special toolkit is successfully called, the adapter returns the calling result of the special toolkit to the target application. Among them, the target application can be, but is not limited to, various applications, public accounts, applets, quick applications, etc., such as Alipay and WeChat. The adapter is an interface converter configured in a software runtime environment, which can be provided by the Madp (Mobile Application Development Platform) project. The Madp project brings together SDKs for many host environments. The target application and the adapter are hosted on the same computer device, which may be, but is not limited to, various personal computers, laptops, smartphones, tablet computers, and servers.
[0051] In one embodiment, Figure 2 As shown, a software development kit calling method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the adapter in the figure:
[0052] Step S202: receiving a calling instruction sent by the target application through a calling interface provided by the adapter.
[0053] The calling interface is used to communicate with applications running in hosts of various environment categories, and the calling instruction carries the target toolkit information. The target application sends a calling instruction to the adapter by calling the calling interface provided by the adapter. The calling interface receives the calling instruction, that is, the adapter receives the calling instruction sent by the target application through the calling interface, triggering the adapter action.
[0054] Specifically, the adapter provides a call interface, which is used to communicate instructions with applications running in hosts of various environment categories. Therefore, applications running in hosts of various environment categories can call the adapter through the unified interface provided by the adapter and send call instructions to the adapter. The adapter receives the call instruction sent by the target application through the call interface provided by the adapter. The call instruction carries the target toolkit information. The adapter can call the target toolkit through the call interface provided by the target toolkit.
[0055] For example, the target application calls the Madp.A interface provided by the adapter and sends a call instruction to the adapter to call the target toolkit A, so that the adapter can call the target toolkit A through the SDK.A interface provided by the host. Among them, the SDK.A interface is provided by the host, and the SDK.A interfaces provided by hosts of different environment categories may be different, but the Madp.A interface is provided by the adapter and has nothing to do with the host's environment category. Therefore, the Madp.A interface provided by the adapter is consistent in hosts of different environment categories.
[0056] For another example, the target application calls the Madp.B interface provided by the adapter and sends a call instruction to the adapter to call the target toolkit B, so that the adapter can call the target toolkit B through the SDK.B interface provided by the host. Among them, the SDK.B interface is provided by the host, and the SDK.B interfaces provided by hosts of different environment categories may be different, but the Madp.B interface is provided by the adapter and has nothing to do with the environment category of the host. Therefore, the Madp.B interface provided by the adapter is consistent in hosts of different environment categories.
[0057] In this embodiment, the adapter provides a call interface, which is used to communicate instructions with applications running in hosts of various environment categories. Hosts of different environment categories can send call instructions to the adapter by calling the call interface provided by the adapter. The adapter receives the call instruction sent by the target application through the call interface. The call instruction carries the target toolkit information, and can call the target toolkit to implement the call of the target toolkit. Moreover, the applications running in hosts of different environment categories all call the same call interface provided by the adapter, which effectively improves the development efficiency compared with calling the call interface corresponding to the target environment category to which each host belongs.
[0058] Step S204: determining the target environment category of the host where the target application is located according to the calling instruction.
[0059] The host where the target application is located is the current application environment of the software, and the target environment category is the category to which the host where the target application is located belongs, for example, IOS system, Android system, etc.
[0060] The host contains an SDK that encapsulates various basic functions. Applications running in the host can call the functions encapsulated in the SDK through APIs. Applications running in hosts belonging to the same environment category call the same SDK APIs, while applications running in hosts belonging to different environment categories may call different SDK APIs.
[0061] For example, two users are using the CMB Financial APP on their respective terminals. One user registers on the CMB Financial APP, and the other user updates personal information on the CMB Financial APP. Both the registration and personal information updates require taking user images, so the CMB Financial APPs used by both users will call the SDK API for taking photos. However, one user's terminal uses the iOS system, and the other user's terminal uses the Android system. The host environment categories of the CMB Financial APPs in the two users' terminals are different, so the SDK APIs for taking photos are different.
[0062] For example, a user is using the WeChat APP on the terminal to share food, and another user is using the Alipay APP on the terminal to recommend food. Both sharing and recommending food require obtaining the user's location, so both the WeChat APP and the Alipay APP will call the SDK API to obtain location information. However, the two users' terminals use the Android system, and the host environment category of the WeChat APP and the Alipay APP belongs to the same, so the SDK API to obtain location information is the same.
[0063] Specifically, the adapter sends an information acquisition request to the host where the target application is located, and requests the host information of the host where the target application is located. The host where the target application is located receives the information acquisition request sent by the adapter and sends its own information to the adapter. The adapter receives the host information sent by the host where the target application is located, and determines the target environment category to which the host where the target application is located belongs according to the host information.
[0064] In this embodiment, the calling instruction triggers the adapter to determine the target environment category to which the host where the target application is located belongs. Different APIs can be used to call the target toolkit according to the different target application categories to which the host where the target application is located belongs, thereby meeting the toolkit calling needs of applications running in hosts of different environment categories.
[0065] Step S206: If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the dedicated toolkit is called through a dedicated interface corresponding to the target environment category.
[0066] Among them, the dedicated toolkit is a toolkit dedicated to the application in the host of the target environment category. The dedicated toolkit is a toolkit configured by the host and can only be used by applications in the host of the same environment category, that is, the dedicated toolkit is a toolkit configured by the host of the target environment category and used by applications running in the host of the target environment category.
[0067] If the host configuration of the target environment category has a dedicated toolkit corresponding to the target toolkit information, the adapter can call the dedicated toolkit configured by the host of the target environment category to implement the call of the target toolkit. When calling, the adapter calls the dedicated interface corresponding to the target environment category to implement the call of the dedicated toolkit.
[0068] Specifically, according to the target environment category to which the host where the target application is located belongs, the dedicated toolkit configured by the host of the target environment category can be determined. If there is a dedicated toolkit corresponding to the target toolkit information in the dedicated toolkit configured by the host of the target environment category, it can be determined that the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information. If there is no dedicated toolkit corresponding to the target toolkit information in the dedicated toolkit configured by the host of the target environment category, it can be determined that the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information.
[0069] If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the adapter can directly call the dedicated interface corresponding to the dedicated toolkit to implement the calling of the dedicated toolkit.
[0070] In this embodiment, since the calling interfaces of the dedicated toolkits configured by the hosts belonging to the same environment category are the same, and the calling interfaces of the dedicated toolkits configured by the hosts belonging to different environment categories are different, the dedicated toolkits configured by the hosts correspond one-to-one to the environment category to which the hosts belong, and further, the calling interfaces of the dedicated toolkits correspond one-to-one to the environment category to which the hosts belong. Since the calling of the dedicated toolkit can be realized by calling the dedicated interface corresponding to the dedicated toolkit, if the host of the target environment category is configured with the dedicated toolkit corresponding to the target toolkit information, the dedicated toolkit is called through the dedicated interface corresponding to the target environment category to realize the calling of the target toolkit.
[0071] Step S208: When the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application.
[0072] The calling result of the dedicated toolkit is the result obtained after the dedicated toolkit is called. For example, when calling an SDK for taking photos, the calling result is the user image taken. For another example, when calling an SDK for obtaining location information, the calling result is the current location coordinates.
[0073] Specifically, the adapter calls the dedicated toolkit, the dedicated toolkit feeds back the calling result to the adapter, and the adapter forwards the calling result to the target application.
[0074] In this embodiment, the function of the target application calling the target toolkit can be realized by returning the calling result of the dedicated toolkit to the target application when the dedicated toolkit is successfully called.
[0075] In the above software development kit calling method, a calling interface is provided by an adapter, and the calling interface is used to communicate instructions with applications running in hosts of various environment categories, and the target application can send a calling instruction to the adapter. The calling instruction carries the target toolkit information, and the target application can call the target toolkit through the adapter. The adapter receives the calling instruction sent by the target application through the calling interface, and can use the calling instruction as a trigger signal to determine the target environment category to which the host where the target application is located belongs. If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the adapter can call the dedicated toolkit dedicated to the application in the host of this environment category through the dedicated interface corresponding to the environment category, and when the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application. The whole process is mainly completed by the adapter, and the target application only needs to send a calling instruction to the adapter to receive the calling result returned by the adapter. Since the calling interface of the adapter receiving the calling instruction is used to communicate instructions with applications running in hosts of various environment categories, it has nothing to do with the environment category to which the host where the target application is located belongs, so applications running in hosts of different environment categories can send calling instructions to a unified calling interface, and use the adapter to call the target toolkit, thereby effectively improving development efficiency.
[0076] In one embodiment, the target environment category to which the host where the target application is located belongs is determined based on the calling instruction, including: obtaining user agent information of the host where the target application is located based on the calling instruction; obtaining an identifier of the host where the target application is located from the user agent information; and determining the target environment category to which the host where the target application is located belongs based on the identifier of the host where the target application is located.
[0077] The user agent information (User Agent) is a special string header, including information such as the host's browser type, operating system, browser kernel, and running applications.
[0078] Specifically, the adapter uses the call instruction as a trigger signal to send a request to obtain the user agent information to the host where the target application is located. The host where the target application is located feeds back the user agent information to the adapter based on the acquisition request. The user agent information includes the host information. The adapter extracts the identifier of the host where the target application is located from the user agent information, and then determines the target environment category to which the host where the target application is located belongs.
[0079] In this embodiment, the calling instruction triggers the adapter to obtain the user agent information of the host where the target application is located. The identification of the host where the target application is located can be obtained from the user agent information, and then the target environment category to which the host where the target application is located is determined based on the identification of the host where the target application is located. The target environment category to which the host where the target application is located is obtained, and the corresponding dedicated interface is called according to the target environment category to which the host where the target application is located to implement the call of the dedicated toolkit.
[0080] In one embodiment, the method further includes: searching for a dedicated toolkit corresponding to the target toolkit information in a list of toolkits provided for the host of the target environment category; if the dedicated toolkit is found, determining that the host of the target environment category is configured with the dedicated toolkit; if the dedicated toolkit is not found, determining that the host of the target environment category is not configured with the dedicated toolkit.
[0081] For each environment category, a list of toolkits configured by the host is established to form a list of toolkits configured for the hosts of each environment category. Each toolkit on the list is a toolkit configured for the hosts of the same environment category. If a toolkit is on the list, it means that the host of the corresponding environment category is configured with this toolkit; if a toolkit is not on the list, it means that the host of the corresponding environment category is not configured with this toolkit.
[0082] Specifically, after determining the target environment category to which the host where the target application is located belongs, obtain a list of toolkits configured for the host of the target environment category. Compare the toolkits in the obtained list with the dedicated toolkits corresponding to the target toolkit information one by one. If a toolkit in the obtained list is the same as the dedicated toolkit corresponding to the target toolkit information, it means that the dedicated toolkit is searched in the obtained list, and it can be determined that the host of the target environment category is configured with a dedicated toolkit; if all the toolkits in the obtained list are different from the dedicated toolkits corresponding to the target toolkit information, it means that the dedicated toolkit is not searched in the obtained list, and it is determined that the host of the target environment category is not configured with a dedicated toolkit.
[0083] In this embodiment, the adapter searches for the dedicated toolkit corresponding to the target toolkit information in the list of toolkits equipped by the host of the target environment category, and can determine whether the host of the target environment category is equipped with the dedicated toolkit based on the search result, which is simple and convenient to implement.
[0084] In one embodiment, the method further includes: before calling the dedicated toolkit through the dedicated interface corresponding to the target environment category, obtaining the dedicated interface corresponding to the target environment category in the list.
[0085] For each environment category, a list of toolkits configured by the host is established to form a list of toolkits configured by the host of each environment category. In addition to the identifier of the special toolkit, the list also has a special interface for calling the special toolkit.
[0086] Specifically, if a dedicated toolkit corresponding to the target toolkit information is searched in the list of toolkits provided by the host of the target environment category, a dedicated interface corresponding to the searched dedicated toolkit is obtained, that is, the dedicated interface corresponding to the target environment category.
[0087] In this embodiment, the adapter obtains the dedicated interface corresponding to the target environment category in the list, and can call the dedicated toolkit by calling this dedicated interface, which is simple and convenient to implement.
[0088] In one embodiment, the method further includes: if the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information, calling the general toolkit through a general interface; when the general toolkit call is successful, returning the calling result of the general toolkit to the target application.
[0089] The general toolkit is a toolkit common to applications in hosts of various environment categories. The general toolkit is a toolkit configured by the adapter and is applicable to applications running in hosts of all environment categories. Therefore, the general toolkit is a toolkit used by applications running in hosts of various environment categories including the target environment category.
[0090] The general interface is the calling interface of the general toolkit. Applications running in hosts of various environment categories can call the general toolkit by calling the general interface.
[0091] The result of calling a general toolkit is the result obtained after calling the general toolkit. For example, when calling a photo-taking SDK, the result is the user image taken. For another example, when calling an SDK to obtain location information, the result is the current location coordinates.
[0092] Specifically, after obtaining the list of toolkits equipped with the host of the target environment category, the toolkits in the obtained list are compared one by one with the special toolkits corresponding to the target toolkit information. If all the toolkits in the obtained list are different from the special toolkits corresponding to the target toolkit information, it means that the special toolkit cannot be found in the obtained list. At this time, it is determined that the host of the target environment category is not equipped with a special toolkit. If the host of the target environment category is not equipped with a special toolkit, the adapter calls the general interface to implement the call of the general toolkit. After the adapter calls the general toolkit, the general toolkit feeds back the call result to the adapter, and the adapter forwards the call result to the target application.
[0093] In this embodiment, when the host of the target environment category is not configured with a dedicated toolkit, the adapter calls the general toolkit through a general interface, and returns the call result of the general toolkit to the target application when the general toolkit call is successful. When the host where the target application is located is not configured with a dedicated toolkit, the general toolkit can be used for backup processing to ensure that the target toolkit can be called.
[0094] In one embodiment, the method further includes: if the dedicated toolkit call fails, or the general toolkit call fails, returning error information to the target application.
[0095] The error information is information indicating that the target toolkit call failed, such as an error prompt message.
[0096] Specifically, when the adapter fails to call the dedicated toolkit or the general toolkit, the dedicated toolkit or the general toolkit will feedback error information to the adapter, and the adapter will forward the error information to the target application.
[0097] In this embodiment, when the dedicated toolkit call or the general toolkit call fails, the adapter returns error information to the target application so that the target application can understand the call situation in time and perform corresponding processing.
[0098] In one embodiment, logs are returned to the target application.
[0099] In one embodiment, the calling instruction is an instruction triggered and generated after the target application has loaded all toolkits configured in the host where the target application is located.
[0100] The toolkit configured by the host can only be called after loading is completed. First, all the toolkits configured by the host where the target application is located are loaded, and then the calling instruction is generated. At this time, the calling instruction is triggered by the target application after loading all the toolkits configured by the host where the target application is located. This can ensure the calling speed, avoid slowing down the calling speed due to loading the corresponding toolkit during the calling process, and realize the instant calling of the toolkit.
[0101] Specifically, during the process of loading the host of an application, applet, etc., all toolkits configured by the host where the target application is located are loaded in advance, so that when the target application calls the target toolkit through a calling instruction, the adapter can call it immediately.
[0102] In this embodiment, the calling instruction is an instruction triggered and generated after the target application completes loading of all toolkits configured in the host where the target application is located. When the target application calls the target toolkit through the calling instruction, the target toolkit has been loaded and can be called immediately, thereby improving the calling speed.
[0103] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0104] In one embodiment, Figure 3 As shown, a software development kit calling device is provided, including: a receiving module 301, a determining module 302, a calling module 303 and a returning module 304, wherein:
[0105] The receiving module 301 is used to receive a calling instruction sent by a target application through a calling interface provided by the adapter. The calling interface is used to communicate instructions with applications running in hosts of various environment categories. The calling instruction carries target toolkit information.
[0106] The determination module 302 is used to determine the target environment category to which the host where the target application is located belongs according to the calling instruction.
[0107] The calling module 303 is used to call the dedicated toolkit through the dedicated interface corresponding to the target environment category if the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information. The dedicated toolkit is a toolkit dedicated to the application in the host of the target environment category.
[0108] The return module 304 is used to return the calling result of the dedicated toolkit to the target application when the calling of the dedicated toolkit is successful.
[0109] The software development kit calling device provides a calling interface through an adapter, and the calling interface is used to communicate instructions with applications running in hosts of various environmental categories. The target application can send a calling instruction to the adapter. The calling instruction carries the target toolkit information, and the target application can call the target toolkit through the adapter. The adapter receives the calling instruction sent by the target application through the calling interface, and can use the calling instruction as a trigger signal to determine the target environment category to which the host where the target application is located belongs. If the host of the target environment category is configured with a special toolkit corresponding to the target toolkit information, the adapter can call the special toolkit dedicated to the application in the host of this environment category through the special interface corresponding to the environment category, and when the special toolkit is successfully called, the calling result of the special toolkit is returned to the target application. The whole process is mainly completed by the adapter, and the target application only needs to send a calling instruction to the adapter to receive the calling result returned by the adapter. Since the calling interface of the adapter receiving the calling instruction is used to communicate instructions with applications running in hosts of various environmental categories, it has nothing to do with the environmental category to which the host where the target application is located belongs. Therefore, applications running in hosts of different environmental categories can send calling instructions to a unified calling interface and use the adapter to call the target toolkit, thereby effectively improving development efficiency.
[0110] In one embodiment, the determination module 302 includes an acquisition unit, an extraction unit, and a determination unit. The acquisition unit is used to acquire user agent information of the host where the target application is located according to the call instruction. The extraction unit is used to obtain the identifier of the host where the target application is located from the user agent information. The determination unit is used to determine the target environment category to which the host where the target application is located belongs according to the identifier of the host where the target application is located.
[0111] In one embodiment, the device further includes a search module and a determination module. The search module is used to search for a special toolkit corresponding to the target toolkit information in the list of toolkits configured for the host of the target environment category. The determination module is used to determine that the host of the target environment category is configured with the special toolkit if the special toolkit is found; and to determine that the host of the target environment category is not configured with the special toolkit if the special toolkit is not found.
[0112] In one embodiment, the device further comprises an acquisition module, which is used to acquire the dedicated interface corresponding to the target environment category in the list before calling the dedicated toolkit through the dedicated interface corresponding to the target environment category.
[0113] In one embodiment, the calling module 303 is further used to call the general toolkit through the general interface if the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information. The general toolkit is a toolkit common to applications in hosts of various environment categories. The returning module 304 is further used to return the calling result of the general toolkit to the target application when the calling of the general toolkit is successful.
[0114] In one embodiment, the return module 304 is further configured to return error information to the target application if the dedicated toolkit call fails or the general toolkit call fails.
[0115] In one embodiment, the calling instruction is an instruction triggered and generated after the target application has loaded all toolkits configured in the host where the target application is located.
[0116] For the specific limitations of the software development kit calling device, please refer to the limitations of the software development kit calling method above, which will not be repeated here. Each module in the above-mentioned software development kit calling device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0117] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a software development kit calling method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0118] Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0119] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: receiving a calling instruction sent by a target application through a calling interface provided by an adapter, the calling interface being used to communicate instructions with applications running in hosts of various environment categories, the calling instruction carrying target toolkit information; determining, according to the calling instruction, a target environment category to which the host where the target application is located belongs; if the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, calling the dedicated toolkit through a dedicated interface corresponding to the target environment category, the dedicated toolkit being a toolkit dedicated to the application in the host of the target environment category; and returning the calling result of the dedicated toolkit to the target application when the calling of the dedicated toolkit is successful.
[0120] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to the calling instruction, the user agent information of the host where the target application is located is obtained; the identifier of the host where the target application is located is obtained from the user agent information; and according to the identifier of the host where the target application is located, the target environment category to which the host where the target application is located belongs is determined.
[0121] In one embodiment, when the processor executes the computer program, the following steps are also implemented: searching for a special toolkit corresponding to the target toolkit information in the list of toolkits equipped with the host of the target environment category; if the special toolkit is found, it is determined that the host of the target environment category is configured with the special toolkit; if the special toolkit is not found, it is determined that the host of the target environment category is not configured with the special toolkit.
[0122] In one embodiment, when the processor executes the computer program, the following steps are further implemented: before calling the dedicated toolkit through the dedicated interface corresponding to the target environment category, obtaining the dedicated interface corresponding to the target environment category in the list.
[0123] In one embodiment, the processor also implements the following steps when executing the computer program: if the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information, a universal toolkit is called through a universal interface, and the universal toolkit is a toolkit common to applications in hosts of various environment categories; when the universal toolkit is called successfully, the calling result of the universal toolkit is returned to the target application.
[0124] In one embodiment, when the processor executes the computer program, the following steps are further implemented: if the dedicated toolkit call fails, or the general toolkit call fails, an error message is returned to the target application.
[0125] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the calling instruction is an instruction triggered and generated after the target application completes loading of all toolkits configured in the host where the target application is located.
[0126] The above-mentioned computer device provides a calling interface through an adapter, and the calling interface is used to communicate instructions with applications running in hosts of various environmental categories, and the target application can send a calling instruction to the adapter. The calling instruction carries target toolkit information, and the target application can call the target toolkit through the adapter. The adapter receives the calling instruction sent by the target application through the calling interface, and can use the calling instruction as a trigger signal to determine the target environment category to which the host where the target application is located belongs. If the host of the target environment category is configured with a special toolkit corresponding to the target toolkit information, the adapter can call the special toolkit dedicated to the application in the host of this environment category through the special interface corresponding to the environment category, and when the special toolkit is successfully called, the calling result of the special toolkit is returned to the target application. The whole process is mainly completed by the adapter, and the target application only needs to send a calling instruction to the adapter to receive the calling result returned by the adapter. Since the calling interface of the adapter receiving the calling instruction is used to communicate instructions with applications running in hosts of various environmental categories, it has nothing to do with the environmental category to which the host where the target application is located belongs, so applications running in hosts of different environmental categories can send calling instructions to a unified calling interface, and use the adapter to call the target toolkit, thereby effectively improving development efficiency.
[0127] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: a calling instruction sent by a target application is received through a calling interface provided by an adapter, the calling interface is used to communicate instructions with applications running in hosts of various environment categories, and the calling instruction carries target toolkit information; based on the calling instruction, a target environment category to which the host where the target application is located belongs is determined; if the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the dedicated toolkit is called through a dedicated interface corresponding to the target environment category, and the dedicated toolkit is a toolkit dedicated to the application in the host of the target environment category; when the dedicated toolkit is called successfully, the calling result of the dedicated toolkit is returned to the target application.
[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the calling instruction, the user agent information of the host where the target application is located is obtained; the identifier of the host where the target application is located is obtained from the user agent information; and according to the identifier of the host where the target application is located, the target environment category to which the host where the target application is located belongs is determined.
[0129] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: searching for a special toolkit corresponding to the target toolkit information in the list of toolkits equipped with the host of the target environment category; if the special toolkit is found, it is determined that the host of the target environment category is configured with the special toolkit; if the special toolkit is not found, it is determined that the host of the target environment category is not configured with the special toolkit.
[0130] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: before calling the dedicated toolkit through the dedicated interface corresponding to the target environment category, obtaining the dedicated interface corresponding to the target environment category in the list.
[0131] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information, a universal toolkit is called through a universal interface, and the universal toolkit is a toolkit common to applications in hosts of various environment categories; when the universal toolkit is called successfully, the calling result of the universal toolkit is returned to the target application.
[0132] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: if the dedicated toolkit call fails, or the general toolkit call fails, an error message is returned to the target application.
[0133] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the calling instruction is an instruction triggered and generated after the target application completes loading of all toolkits configured in the host where the target application is located.
[0134] The above storage medium provides a call interface through an adapter, and the call interface is used to communicate instructions with applications running in hosts of various environmental categories, and the target application can send a call instruction to the adapter. The call instruction carries the target toolkit information, and the target application can call the target toolkit through the adapter. The adapter receives the call instruction sent by the target application through the call interface, and can use the call instruction as a trigger signal to determine the target environment category to which the host where the target application is located belongs. If the host of the target environment category is configured with a special toolkit corresponding to the target toolkit information, the adapter can call the special toolkit dedicated to the application in the host of this environment category through the special interface corresponding to the environment category, and when the special toolkit is successfully called, the call result of the special toolkit is returned to the target application. The whole process is mainly completed by the adapter, and the target application only needs to send a call instruction to the adapter to receive the call result returned by the adapter. Since the call interface of the adapter receiving the call instruction is used to communicate instructions with applications running in hosts of various environmental categories, it has nothing to do with the environmental category to which the host where the target application is located belongs, so applications running in hosts of different environmental categories can send call instructions to a unified call interface, and use the adapter to call the target toolkit, thereby effectively improving development efficiency.
[0135] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0136] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0137] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for calling a software development kit, characterized in that: Applied to an adapter, the method comprises: Receiving a call instruction sent by a target application through a call interface provided by the adapter, wherein the call interface is used to communicate instructions with applications running in hosts of various environment categories, and the call instruction carries target toolkit information; Determining, by the adapter according to the calling instruction, a target environment category to which the host where the target application is located belongs, wherein the target environment category includes an IOS system and an Android system; If the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, the adapter calls the dedicated toolkit through a dedicated interface corresponding to the target environment category, and the dedicated toolkit is configured for the host of the target environment category and is dedicated to an application in the host of the target environment category; When the dedicated toolkit is successfully called, the calling result of the dedicated toolkit is returned to the target application through the adapter; If the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information, the adapter calls a universal toolkit through a universal interface, the universal toolkit being a toolkit common to applications in hosts of various environment categories and being a toolkit configured by the adapter; When the general toolkit is successfully called, the calling result of the general toolkit is returned to the target application through the adapter.
2. The method according to claim 1, characterized in that The step of determining, according to the calling instruction, a target environment category to which the host where the target application is located belongs includes: According to the calling instruction, obtaining user agent information of the host where the target application is located; Obtaining an identifier of a host where the target application is located from the user agent information; According to the identifier of the host where the target application is located, the target environment category to which the host where the target application is located belongs is determined.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Searching for a dedicated toolkit corresponding to the target toolkit information in a list of toolkits provided to hosts of the target environment category; If the dedicated toolkit is found, determining that the host of the target environment category is configured with the dedicated toolkit; If the dedicated toolkit cannot be found in the search, it is determined that the host of the application environment category is not configured with the dedicated toolkit.
4. The method according to claim 3, characterized in that The method further comprises: Before calling the dedicated toolkit through the dedicated interface corresponding to the target environment category, the dedicated interface corresponding to the target environment category is obtained from the list.
5. The method according to claim 1, characterized in that: The method further comprises: If the dedicated toolkit call fails, or the general toolkit call fails, an error message is returned to the target application.
6. The method according to claim 1 or 2, characterized in that: The calling instruction is an instruction triggered and generated after the target application has loaded all toolkits configured in the host where the target application is located.
7. A software development kit calling device, characterized in that: The device comprises: A receiving module, used to receive a calling instruction sent by a target application through a calling interface provided by the adapter, wherein the calling interface is used to communicate instructions with applications running in hosts of various environment categories, and the calling instruction carries target toolkit information; A determination module, used to determine, through the adapter according to the calling instruction, a target environment category to which the host where the target application is located belongs, wherein the target environment category includes an IOS system and an Android system; a calling module, configured to, if the host of the target environment category is configured with a dedicated toolkit corresponding to the target toolkit information, cause the adapter to call the dedicated toolkit through a dedicated interface corresponding to the target environment category, wherein the dedicated toolkit is configured for the host of the target environment category and is dedicated to an application in the host of the target environment category; A return module, used for returning the calling result of the dedicated toolkit to the target application through the adapter when the calling of the dedicated toolkit is successful; The calling module is further used for, if the host of the target environment category is not configured with a dedicated toolkit corresponding to the target toolkit information, the adapter calling a general toolkit through a general interface, the general toolkit being a toolkit common to application programs in hosts of various environment categories, and the general toolkit being a toolkit configured by the adapter; The return module is further configured to return the calling result of the general toolkit to the target application via the adapter when the calling of the general toolkit is successful.
8. The device according to claim 7, characterized in that The determination module includes an acquisition unit, an extraction unit and a determination unit; the acquisition unit is used to acquire the user agent information of the host where the target application is located according to the calling instruction; the extraction unit is used to obtain the identifier of the host where the target application is located from the user agent information; The determining unit is used to determine the target environment category to which the host where the target application is located belongs according to the identifier of the host where the target application is located.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Software development kit function calling method, system, electronic equipment and medium
CN110362364A
Living body recognition method, system and device, equipment and computer readable storage medium
CN110852259A