CN114528054B - Third party SDK initialization method, device, equipment and medium based on service module - Google Patents

Third party SDK initialization method, device, equipment and medium based on service module Download PDF

Info

Publication number
CN114528054B
CN114528054B CN202210059645.7A CN202210059645A CN114528054B CN 114528054 B CN114528054 B CN 114528054B CN 202210059645 A CN202210059645 A CN 202210059645A CN 114528054 B CN114528054 B CN 114528054B
Authority
CN
China
Prior art keywords
class
implementation
application program
module
service module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210059645.7A
Other languages
Chinese (zh)
Other versions
CN114528054A (en
Inventor
李捷明
罗森
荀海峰
赵海兴
申传旺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202210059645.7A priority Critical patent/CN114528054B/en
Publication of CN114528054A publication Critical patent/CN114528054A/en
Application granted granted Critical
Publication of CN114528054B publication Critical patent/CN114528054B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a third party SDK initialization method, a device, equipment and a medium based on a service module, wherein the method comprises the following steps: determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module; creating an initialization method of an external interface, and creating a basic application program class for a basic module, wherein the application program class is used for inheriting an application program; creating an implementation class of an external interface in each service module of the third party SDK to be called; managing the class package name of the implementation class through a preset method in the basic application class; the corresponding realization class is obtained through reflection by the class package name of the realization class, and the initialization method in the corresponding realization class is called; and calling the third party SDK of the corresponding service module through the corresponding initialization method in the implementation class, and initializing the third party SDK of the corresponding service module. And the third party SDK initialization efficiency of the service module is improved by combining an interface and a reflection mode.

Description

Third party SDK initialization method, device, equipment and medium based on service module
Technical Field
The present application relates to the field of software development technologies, and in particular, to a method, an apparatus, a device, and a medium for initializing a third party SDK based on a service module.
Background
To promote products and services, a software development kit (Software Development Kit, SDK) is provided to third party developers, which can be invoked by applications. While an application program is developed, it often needs to involve multiple different service modules, each of which needs a different function, i.e. needs to call a different third party SDK.
When the application program calls the third party SDK of the service module, the third party SDK of the service module needs to be initialized, and the initialization process needs to be done in the application program.
However, when the componentized service is decoupled, as a plurality of different service modules need to conform to the service decoupling principle, not all the service modules of all the third party SDKs are used, the application programs where the service modules are positioned are unsuitable, the decoupling principle is against, the application programs can not be combined after being placed under the respective service modules, great difficulty is brought to developers, and the third party SDKs of the service modules are low in initializing efficiency.
Disclosure of Invention
The embodiment of the application provides a third party SDK initializing method, device, equipment and medium based on a service module, which are used for solving the problem of low third party SDK initializing efficiency of the service module.
The embodiment of the application adopts the following technical scheme:
in one aspect, an embodiment of the present application provides a service module-based third party SDK initialization method, where the method includes: determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module; creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the application program class is used for inheriting the application program; creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program; managing the class package name of the implementation class through a preset method in the basic application program class; the corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called; and calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module.
In one example, the managing the class packet name of the implementation class through a preset method in the application class specifically includes: creating a package name management class, constructing an array in the package name management class, and adding the class package name of the implementation class into the array; and managing the class package names of the implementation classes in the package name management class through a preset method in the application program class.
In one example, the method further comprises: the third party SDK in each service module is not exposed to the outside, and the third party SDK is called by the corresponding service module.
In one example, the obtaining, by reflection, the corresponding implementation class through the class packet name of the implementation class specifically includes: according to the class packet names of the implementation classes, matching the class packet names of the implementation classes of the external interfaces, which are created in advance, in each service module in sequence; and if the matching is successful, taking the realization class which is successfully matched as the corresponding realization class.
In one example, after the matching the class packet name of the implementation class of the external interface, the method further includes: if the matching fails, acquiring log information of the application program in a last period of time; retrieving operation information about each service module from the log information; judging whether a service module of a deletion realization class exists or not through the operation information; if yes, comparing the class package name of the realization class with the class package name of the deletion realization class; and if the comparison is successful, deleting the class packet name of the implementation class.
In one example, if the comparison is successful, deleting the class packet name of the implementation class specifically includes: if the comparison is successful, notifying a manager that the implementation class corresponding to the class packet name of the implementation class is deleted and the deleted time, and sending a request for deleting the class packet name of the implementation class to the manager; and deleting the class package name of the implementation class after the manager agrees.
In one example, after the determining whether there is a service module for deleting an implementation class according to the operation information, the method further includes: if the service module deleting the implementation class does not exist, sending notification information to a manager to prompt that the matching of the class packet name of the implementation class fails.
In another aspect, an embodiment of the present application provides a service module-based third party SDK initializing device, where the device includes: the first creation module is used for determining a base module which is cited by a plurality of service modules of the application program and creating an external interface for the base module; the second creation module creates the initialization method of the external interface and creates a basic application program class for the basic module, wherein the basic application program class is used for inheriting the application program; the third creating module is used for creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program; the management module is used for managing the class package name of the implementation class through a preset method in the basic application program class; the reflection acquisition module is used for acquiring a corresponding implementation class through reflection according to the class packet name of the implementation class and calling an initialization method in the corresponding implementation class; and the initialization module is used for calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class and initializing the third party SDK of the corresponding service module.
On the other hand, the embodiment of the application provides a third party SDK initializing device based on a service module, which comprises the following components: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to: determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module; creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the basic application program class is used for inheriting the application program; creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program; managing the class package name of the implementation class through a preset method in the basic application program class; the corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called; and calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module.
In another aspect, an embodiment of the present application provides a service module-based third party SDK initialization non-volatile computer storage medium storing computer executable instructions configured to: determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module; creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the basic application program class is used for inheriting the application program; creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program; managing the class package name of the implementation class through a preset method in the basic application program class; the corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called; and calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module.
The above at least one technical scheme adopted by the embodiment of the application can achieve the following beneficial effects:
By combining an interface and a reflection mode, an external interface is created for a basic module, an initialization method of the external interface and a basic application program class are created, so that an application program can trigger the task of third-party SDK initialization of each service module under the basic module, and the initialization method can be realized under the service module by creating an implementation class of the external interface, so that the basic module can call the initialization method of the third-party SDK without referring to the third-party SDK of the service module, the service module refers to the basic module, an instance of an application program required for initialization can be acquired, the calling time of the third-party SDK is ensured to finish initialization, the assembly service decoupling is ensured, the normal initialization of the third-party SDK is ensured, and the initialization efficiency of the third-party SDK of the service module is improved.
Drawings
In order to more clearly illustrate the technical solution of the present application, some embodiments of the present application will be described in detail below with reference to the accompanying drawings, in which:
Fig. 1 is a schematic flow chart of a third party SDK initialization method based on a service module according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a third party SDK initializing device based on a service module according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a third party SDK initializing device based on a service module according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Some embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flow chart of a third party SDK initialization method based on a service module according to an embodiment of the present application. Some of the input parameters or intermediate results in the flow allow for manual intervention adjustments to help improve accuracy.
The implementation of the analysis method according to the embodiment of the present application may be a terminal device or a server, which is not particularly limited in the present application. For ease of understanding and description, the following embodiments are described in detail with reference to a server.
It should be noted that the server may be a single device, or may be a system formed by a plurality of devices, that is, a distributed server, which is not particularly limited in the present application.
The flow in fig. 1 may include the steps of:
s101: and determining a base module referenced by a plurality of service modules of the application program, and creating an external interface for the base module.
In some embodiments of the present application, when an application program is developed, it often needs to involve a plurality of different business modules, for example, a sharing module needs to be shared by a third party, and a map positioning module needs to be positioned by a high-altitude map. The application program comprises a basic module, and the basic module is provided with a development tool which can be used for developing a plurality of business modules, namely, a public development tool equivalent to the business modules.
It should be noted that, the business module needs to refer to the base module, that is, the business module depends on the base module.
S102: and creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the application program class is used for inheriting the application program.
Wherein, when defining the initialization method, the developer is empty in the initialization method.
S103: creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is implemented, the basic application program class is taken as an example of the application program.
In some embodiments of the present application, the implementation class is to implement the content agreed in the external interface. That is, after the developer defines the external interface, the defined initialization method is empty, and then the service module needs to implement the external interface, and an implementation class is needed, and given the specific implementation of the initialization method, how the service module calls the initialization method to initialize the third party SDK is described.
That is, each business module has one implementation class, and class names are different among the plurality of implementation classes, i.e., class package names are different among the plurality of implementation classes.
Creating an implementation class of the external interface in each service module of the third party SDK to be called is equivalent to creating a pseudo application program in the service module to implement the external interface.
In the prior art, when initializing the third party SDK, an instance of the application program is required to be imported, and therefore, in the present application, the basic application program class is taken as an instance of the application program. For example, if the application program is WeChat and needs to call the SDK of the Goldmap, the corresponding statement is: gaode.init ("application instance") - "gaode.init (BaseApplication).
S104: and managing the class package name of the implementation class through a preset method in the basic application class.
In some embodiments of the application, the class package name of the implementation class may be managed in a onCreate method in the underlying application class.
When the class packet name of the implementation class in the service module is acquired, the implementation class can be acquired according to a preset path in a preset period, so that the class packet name of the implementation class is obtained.
Further, in managing the class package name of the implementation class, in order to more conveniently manage the class package name, the server first creates a package name management class, and constructs an array in the package name management class. Then, the class package name of the implementation class is added to the array. And finally, managing the class package names of the implementation classes in the package name management class by a preset method in the application class.
Here, the name of the class package for how to manage the implementation class is not limited. For example, operations such as adding, deleting, sorting and the like are performed on class package names of the implementation classes.
S105: and obtaining the corresponding implementation class through reflection by the class packet name of the implementation class, and calling an initialization method in the corresponding implementation class. For example, the class package name of the A implementation class is reflected to obtain the A implementation class, and then an initialization method in the A implementation class is called. The method can be used for calling the initialization method under each service module in the basic application program class.
In some embodiments of the present application, when obtaining a corresponding implementation class, the server first matches, in each service module, the class packet name of the implementation class of the external interface created in advance in sequence according to the class packet name of the implementation class, and if the matching is successful, the implementation class that is successfully matched is taken as the corresponding implementation class.
If the server does not update the class packet name of the implementation class in the acquisition service module in real time in the process of managing the class packet name, the class packet name of the implementation class in the packet name management class cannot be updated in real time.
Therefore, if the matching fails, the log information of the application program in the last period of time is obtained, and the operation information of each service module is searched in the log information, so that whether the service module of the deletion realization class exists or not is judged through the operation information.
If not, sending notification information to the manager to prompt that the class packet name matching of the implementation class fails.
If yes, comparing the class package name of the realization class with the class package name of the deletion realization class, and if the comparison is successful, deleting the class package name of the realization class.
Further, in order to confirm that the implementation class is consistent with the implementation class deleted in the service module, after the comparison is successful, the server may notify the manager that the implementation class corresponding to the class packet name of the implementation class is deleted, and the deleted time, and send a request for deleting the class packet name of the implementation class to the manager. And finally, deleting the class package name of the implementation class in the array after the agreement of the manager.
S106: and calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module.
It should be noted that, the third party SDK in each service module is not exposed externally, and the third party SDK is called by the corresponding service module, that is, the third party SDK is called by the own service module.
It should be noted that, although the embodiment of the present application is described with reference to fig. 1 to sequentially describe steps S101 to S106, this does not represent that steps S101 to S106 must be performed in strict order. The steps S101 to S106 are sequentially described according to the sequence shown in fig. 1 according to the embodiment of the present application, so as to facilitate the understanding of the technical solution of the embodiment of the present application by those skilled in the art. In other words, in the embodiment of the present application, the sequence between the steps S101 to S106 may be appropriately adjusted according to the actual needs.
By combining the method of the figure 1 with the method of adding reflection to the interface, by creating an external interface for a basic module, an initialization method of the external interface and creating a basic application class, the application can trigger the task of initializing the third-party SDK of each service module under the basic module, and by creating an implementation class of the external interface, the initialization method can be realized under the service module, so that the basic module can call the initialization method of the third-party SDK without referring to the third-party SDK of the service module, the service module refers to the basic module, the instance of the application required for initialization can be acquired, the call opportunity of the third-party SDK is ensured to finish initialization, and thus, the modular service decoupling and the normal initialization of the third-party SDK are ensured.
Based on the same thought, some embodiments of the present application further provide an apparatus, a device, and a non-volatile computer storage medium corresponding to the above method.
Fig. 2 is a schematic structural diagram of a third party SDK initializing device based on a service module according to an embodiment of the present application.
A first creating module 201, which determines a base module referenced by a plurality of service modules of an application program, and creates an external interface for the base module;
The second creating module 202 creates the initialization method of the external interface, and creates a basic application program class for the basic module, where the basic application program class is used to inherit the application program;
A third creating module 203, configured to create an implementation class of the external interface in each service module of the third party SDK to be invoked; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
the management module 204 manages the class package name of the implementation class through a preset method in the basic application class;
the reflection obtaining module 205 obtains the corresponding implementation class through reflection by the class packet name of the implementation class, and invokes the initialization method in the corresponding implementation class;
And the initialization module 206 invokes the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class and initializes the third party SDK of the corresponding service module.
Fig. 3 is a schematic structural diagram of a third party SDK initializing device based on a service module according to an embodiment of the present application, where the device includes:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to:
Determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module;
Creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the application program class is used for inheriting the application program;
Creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
managing the class package name of the implementation class through a preset method in the basic application program class;
The corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called;
and calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module.
Some embodiments of the application provide a business module-based third party SDK initialization non-volatile computer storage medium storing computer executable instructions configured to:
Determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module;
Creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the application program class is used for inheriting the application program;
Creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
managing the class package name of the implementation class through a preset method in the basic application program class;
The corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called;
and calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module.
The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for the apparatus and medium embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, with reference to the section of the method embodiments being relevant.
The devices and media provided in the embodiments of the present application are in one-to-one correspondence with the methods, so that the devices and media also have similar beneficial technical effects as the corresponding methods, and since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media are not repeated here.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the technical principle of the present application should fall within the protection scope of the present application.

Claims (8)

1. A method for initializing a third party Software Development Kit (SDK) based on a business module, the method comprising:
Determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module;
Creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the application program class is used for inheriting the application program;
Creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
managing the class package name of the implementation class through a preset method in the basic application program class;
The corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called;
Calling a third party SDK of a corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module;
The obtaining, by reflection, the corresponding implementation class through the class packet name of the implementation class specifically includes:
according to the class packet names of the implementation classes, matching the class packet names of the implementation classes of the external interfaces, which are created in advance, in each service module in sequence;
If the matching is successful, taking the realization class which is successfully matched as the corresponding realization class;
after the matching is performed on the class packet names of the implementation classes of the external interfaces, the method further comprises:
If the matching fails, acquiring log information of the application program in a last period of time;
retrieving operation information about each service module from the log information;
Judging whether a service module of a deletion realization class exists or not through the operation information;
If yes, comparing the class package name of the realization class with the class package name of the deletion realization class;
And if the comparison is successful, deleting the class packet name of the implementation class.
2. The method according to claim 1, wherein the managing the class package name of the implementation class by a preset method in the application class specifically includes:
Creating a package name management class, constructing an array in the package name management class, and adding the class package name of the implementation class into the array;
and managing the class package names of the implementation classes in the package name management class through a preset method in the application program class.
3. The method according to claim 1, wherein the method further comprises:
The third party SDK in each service module is not exposed to the outside, and the third party SDK is called by the corresponding service module.
4. The method of claim 1, wherein deleting the class packet name of the implementation class if the comparison is successful specifically comprises:
if the comparison is successful, notifying a manager that the implementation class corresponding to the class packet name of the implementation class is deleted and the deleted time, and sending a request for deleting the class packet name of the implementation class to the manager;
and deleting the class package name of the implementation class after the manager agrees.
5. The method according to claim 1, wherein after determining whether there is a service module for deleting an implementation class by the operation information, the method further comprises:
if the service module deleting the implementation class does not exist, sending notification information to a manager to prompt that the matching of the class packet name of the implementation class fails.
6. A third party SDK initialization apparatus based on a service module, the apparatus comprising:
The first creation module is used for determining a base module which is cited by a plurality of service modules of the application program and creating an external interface for the base module;
The second creation module creates the initialization method of the external interface and creates a basic application program class for the basic module, wherein the basic application program class is used for inheriting the application program;
The third creating module is used for creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
The management module is used for managing the class package name of the implementation class through a preset method in the basic application program class;
The reflection acquisition module is used for acquiring a corresponding implementation class through reflection according to the class packet name of the implementation class and calling an initialization method in the corresponding implementation class;
The initialization module is used for calling the third party SDK of the corresponding service module through the initialization method in the corresponding implementation class and initializing the third party SDK of the corresponding service module;
The obtaining, by reflection, the corresponding implementation class through the class packet name of the implementation class specifically includes:
according to the class packet names of the implementation classes, matching the class packet names of the implementation classes of the external interfaces, which are created in advance, in each service module in sequence;
If the matching is successful, taking the realization class which is successfully matched as the corresponding realization class;
after the class packet names of the implementation classes of the external interfaces, which are created in advance, are matched, the method further comprises the following steps:
If the matching fails, acquiring log information of the application program in a last period of time;
retrieving operation information about each service module from the log information;
Judging whether a service module of a deletion realization class exists or not through the operation information;
If yes, comparing the class package name of the realization class with the class package name of the deletion realization class;
And if the comparison is successful, deleting the class packet name of the implementation class.
7. A service module-based third party SDK initialization apparatus, comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to:
Determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module;
Creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the basic application program class is used for inheriting the application program;
Creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
managing the class package name of the implementation class through a preset method in the basic application program class;
The corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called;
Calling a third party SDK of a corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module;
The obtaining, by reflection, the corresponding implementation class through the class packet name of the implementation class specifically includes:
according to the class packet names of the implementation classes, matching the class packet names of the implementation classes of the external interfaces, which are created in advance, in each service module in sequence;
If the matching is successful, taking the realization class which is successfully matched as the corresponding realization class;
after the class packet names of the implementation classes of the external interfaces, which are created in advance, are matched, the method further comprises the following steps:
If the matching fails, acquiring log information of the application program in a last period of time;
retrieving operation information about each service module from the log information;
Judging whether a service module of a deletion realization class exists or not through the operation information;
If yes, comparing the class package name of the realization class with the class package name of the deletion realization class;
And if the comparison is successful, deleting the class packet name of the implementation class.
8. A business module-based third party SDK initialization non-volatile computer storage medium storing computer executable instructions, the computer executable instructions configured to:
Determining a base module which is cited by a plurality of service modules of an application program, and creating an external interface for the base module;
Creating an initialization method of the external interface, and creating a basic application program class for the basic module, wherein the basic application program class is used for inheriting the application program;
Creating the implementation class of the external interface in each service module of the third party SDK to be called; wherein, the class packet names of the implementation classes among the service modules are different; the implementation class is used for implementing the external interface and implementing the initialization method; when the initialization method is realized, the basic application program class is taken as an example of the application program;
managing the class package name of the implementation class through a preset method in the basic application program class;
The corresponding implementation class is obtained through reflection by the class package name of the implementation class, and an initialization method in the corresponding implementation class is called;
Calling a third party SDK of a corresponding service module through the initialization method in the corresponding implementation class, and initializing the third party SDK of the corresponding service module;
The obtaining, by reflection, the corresponding implementation class through the class packet name of the implementation class specifically includes:
according to the class packet names of the implementation classes, matching the class packet names of the implementation classes of the external interfaces, which are created in advance, in each service module in sequence;
If the matching is successful, taking the realization class which is successfully matched as the corresponding realization class;
after the class packet names of the implementation classes of the external interfaces, which are created in advance, are matched, the method further comprises the following steps:
If the matching fails, acquiring log information of the application program in a last period of time;
retrieving operation information about each service module from the log information;
Judging whether a service module of a deletion realization class exists or not through the operation information;
If yes, comparing the class package name of the realization class with the class package name of the deletion realization class;
And if the comparison is successful, deleting the class packet name of the implementation class.
CN202210059645.7A 2022-01-19 2022-01-19 Third party SDK initialization method, device, equipment and medium based on service module Active CN114528054B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210059645.7A CN114528054B (en) 2022-01-19 2022-01-19 Third party SDK initialization method, device, equipment and medium based on service module

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210059645.7A CN114528054B (en) 2022-01-19 2022-01-19 Third party SDK initialization method, device, equipment and medium based on service module

Publications (2)

Publication Number Publication Date
CN114528054A CN114528054A (en) 2022-05-24
CN114528054B true CN114528054B (en) 2024-05-10

Family

ID=81621657

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210059645.7A Active CN114528054B (en) 2022-01-19 2022-01-19 Third party SDK initialization method, device, equipment and medium based on service module

Country Status (1)

Country Link
CN (1) CN114528054B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115061738B (en) * 2022-06-24 2024-05-31 浪潮卓数大数据产业发展有限公司 Service module initialization method, equipment and medium for android componentization
CN115061750B (en) * 2022-06-27 2024-05-31 浪潮卓数大数据产业发展有限公司 Method, device, equipment and medium for componentized data interaction of application program

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109814943A (en) * 2018-12-21 2019-05-28 北京城市网邻信息技术有限公司 Service construction method, loading method and device, electronic equipment, storage medium
CN111209122A (en) * 2019-12-24 2020-05-29 广州华多网络科技有限公司 Interface calling method and device, electronic equipment and storage medium
CN111666116A (en) * 2020-05-27 2020-09-15 平安科技(深圳)有限公司 SDK calling method and device, computer equipment and storage medium
WO2021008119A1 (en) * 2019-07-17 2021-01-21 创新先进技术有限公司 Service processing method, apparatus, and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7321894B2 (en) * 2004-12-29 2008-01-22 Microsoft Corporation Method and apparatus for building metadata driven software development kit

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109814943A (en) * 2018-12-21 2019-05-28 北京城市网邻信息技术有限公司 Service construction method, loading method and device, electronic equipment, storage medium
WO2021008119A1 (en) * 2019-07-17 2021-01-21 创新先进技术有限公司 Service processing method, apparatus, and device
CN111209122A (en) * 2019-12-24 2020-05-29 广州华多网络科技有限公司 Interface calling method and device, electronic equipment and storage medium
CN111666116A (en) * 2020-05-27 2020-09-15 平安科技(深圳)有限公司 SDK calling method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN114528054A (en) 2022-05-24

Similar Documents

Publication Publication Date Title
CN114528054B (en) Third party SDK initialization method, device, equipment and medium based on service module
AU2018310287A1 (en) Smart contract processing method and apparatus
CN111190924A (en) Cross-domain data query method and device
CN110032599B (en) Data structure reading and updating method and device, and electronic equipment
CN110007920B (en) Method and device for acquiring code dependency relationship and electronic equipment
CN111897539A (en) Method and device for deploying applications according to service roles
CN113778445A (en) Cross-platform component generation method and device, electronic equipment and storage medium
CN110895544A (en) Interface data processing method, device, system and storage medium
US11422917B2 (en) Deriving software application dependency trees for white-box testing
CN110968565A (en) Database creation method and system
CN116610568A (en) Method, device, equipment and medium for identifying dependency relationship of codes
CN110083366B (en) Application running environment generation method and device, computing equipment and storage medium
CN111240987B (en) Method and device for detecting migration program, electronic equipment and computer readable storage medium
CN112445600A (en) Method and system for issuing offline data processing task
CN110928941A (en) Data fragment extraction method and device
CN115203050A (en) Method and device for determining dependency relationship of services
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN112540915A (en) Interface test method, device and system
CN112559444A (en) SQL (structured query language) file migration method and device, storage medium and equipment
CN113687973B (en) Control method, equipment and medium for log dynamic output
CN117076473B (en) Metadata operation method, system, equipment and medium for SaaS multi-tenant
CN110688430A (en) Method and device for obtaining data bypass and electronic equipment
CN115061750B (en) Method, device, equipment and medium for componentized data interaction of application program
CN111767330B (en) Data interaction method and device, electronic equipment and storage medium
CN112558975B (en) Method and device for switching codes of components, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant