CN111400068A - Interface control method and device, readable medium and electronic equipment - Google Patents

Interface control method and device, readable medium and electronic equipment Download PDF

Info

Publication number
CN111400068A
CN111400068A CN202010187235.1A CN202010187235A CN111400068A CN 111400068 A CN111400068 A CN 111400068A CN 202010187235 A CN202010187235 A CN 202010187235A CN 111400068 A CN111400068 A CN 111400068A
Authority
CN
China
Prior art keywords
interface
proxy
class
mapping relation
host app
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.)
Granted
Application number
CN202010187235.1A
Other languages
Chinese (zh)
Other versions
CN111400068B (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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010187235.1A priority Critical patent/CN111400068B/en
Publication of CN111400068A publication Critical patent/CN111400068A/en
Application granted granted Critical
Publication of CN111400068B publication Critical patent/CN111400068B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure relates to a control method, a device, a readable medium and an electronic device of an interface, relating to the technical field of electronic information, and being applied to an SDK (software development kit), wherein a host APP (application) is accessed to the SDK, and the method comprises the following steps: and creating an agent class, wherein the agent class is used for realizing a platform interface on the SDK, when executing method calling of the first interface, the agent object of the agent class is used for forwarding the content of the method calling from the first interface to the second interface according to a preset mapping relation so as to enable the host APP to realize method calling, the mapping relation comprises a platform interface and a corresponding relation with an application interface on the host APP, the first interface is any one of the platform interfaces, and the second interface is an interface which is indicated by the mapping relation in the application interface and corresponds to the first interface. According to the method and the device, forwarding from the platform interface to the application interface is achieved through the proxy class according to the mapping relation, the association degree between the SDK and the host APP can be reduced, and the development and maintenance efficiency is improved.

Description

Interface control method and device, readable medium and electronic equipment
Technical Field
The present disclosure relates to the field of electronic information technologies, and in particular, to a method and an apparatus for controlling an interface, a readable medium, and an electronic device.
Background
With the continuous development of electronic information technology, various applications (english: Application, chinese: Application) are appearing in the Application market to meet the diversified demands of users. Some APPs with similar or related functions usually depend on the same set of SDKs (Software Development Kit, chinese), that is, multiple host APPs are accessed on one set of SDKs. And the host APP and the SDK realize method calling through various interfaces. Generally, the SDK includes a plurality of interfaces, and each host APP accessing the SDK needs to include all the interfaces. If the function of a certain host APP only needs to be in butt joint with a part of interfaces, in order to be compiled and passed, other unused interfaces also need to be added to the host APP in a null implementation mode, the compiling difficulty of developers is increased, and the developing and maintaining efficiency is reduced.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides an interface control method, which is applied to a software development kit SDK, where a host application APP is accessed to the SDK, and the method includes:
creating an agent class, wherein the agent class is used for realizing a platform interface on the SDK;
when executing method call of a first interface, forwarding the content of the method call from the first interface to a second interface according to a preset mapping relation through a proxy object of the proxy class so as to enable the host APP to realize the method call;
the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
In a second aspect, the present disclosure provides a control apparatus for an interface, which is applied to a software development kit SDK, where a host application APP is accessed to the SDK, and the apparatus includes:
a creating module, configured to create an agent class, where the agent class is used to implement a platform interface on the SDK;
a forwarding module, configured to forward, when executing a method call of a first interface, content of the method call from the first interface to a second interface according to a preset mapping relationship through a proxy object of the proxy class, so that the host APP implements the method call;
the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
In a third aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which, when executed by a processing apparatus, performs the steps of the method of the first aspect of the present disclosure.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to implement the steps of the method of the first aspect of the present disclosure.
Through the technical scheme, the method comprises the steps of firstly creating an agent class capable of realizing the platform interface on the SDK, and then forwarding the content of method calling from the first interface to the second interface according to the preset mapping relation through the agent object of the agent class when the method calling of the first interface in the platform interface is executed, so that the host APP accessed to the SDK realizes method calling, wherein the mapping relation comprises the corresponding relation between the platform interface and the application interface on the host APP, and the second interface is the interface which is indicated by the mapping relation in the application interface and corresponds to the first interface. According to the method and the device, forwarding of the platform interface on the SDK to the application interface on the host APP is achieved according to the mapping relation through the proxy class, the SDK does not need to pay attention to the application interface when the execution method is called, the host APP does not need to pay attention to the platform interface when the implementation method is called, the association degree between the SDK and the host APP can be reduced, the compiling difficulty is reduced, and the developing and maintaining efficiency is improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 is a schematic diagram of a SDK and host APP deployment according to one embodiment;
FIG. 2 is a flow chart illustrating a method of controlling an interface in accordance with an exemplary embodiment;
FIG. 3 is a flow chart illustrating another method of controlling an interface in accordance with an exemplary embodiment;
FIG. 4 is a flow chart illustrating another method of controlling an interface in accordance with an exemplary embodiment;
FIG. 5 is a flow chart illustrating another method of controlling an interface in accordance with an exemplary embodiment;
FIG. 6 is a flow chart illustrating another method of controlling an interface in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating a control device of an interface in accordance with an exemplary embodiment;
FIG. 8 is a block diagram illustrating a control device of another interface in accordance with an exemplary embodiment;
FIG. 9 is a block diagram illustrating a control device of another interface in accordance with an exemplary embodiment;
FIG. 10 is a block diagram illustrating a control device of another interface in accordance with an exemplary embodiment;
fig. 11 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Before introducing the method, the apparatus, the readable medium, and the electronic device for controlling an interface provided by the present disclosure, an application scenario related to various embodiments of the present disclosure is first introduced. The application scenario may include an SDK, and a host APP that accesses the SDK. The SDK may be deployed on a server, the host APP may be deployed on a terminal device, and data transmission may be performed between the terminal device and the server, as shown in fig. 1. The terminal devices may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Only one host APP can be accessed into the SDK, or a plurality of host APPs can be accessed into the SDK, and the plurality of host APPs can be deployed on one terminal device or different terminal devices.
Fig. 2 is a flowchart illustrating a method for controlling an interface according to an exemplary embodiment, where as shown in fig. 2, the method is applied to an SDK, where a host APP is accessed to the SDK, and includes the following steps:
step 101, creating an agent class, wherein the agent class is used for realizing a platform interface on the SDK.
For example, a proxy class may be created on the SDK that includes all platform interface implementations (or methods) on the SDK. The Proxy class may be, for example, a Proxy class. It is understood that the proxy class encapsulates all platform interfaces on the SDK. The host APP side also comprises a plurality of application interfaces, and any one application interface needs to be in butt joint with a certain platform interface of the SDK and needs to be realized through a proxy object of a proxy class. The proxy class may be a static proxy class or a dynamic proxy class.
102, when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, so that the host APP realizes the method call.
The mapping relation comprises a platform interface and a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any interface in the platform interface, and the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
For example, for a first interface in the platform interfaces, when the SDK executes a method call of the first interface, the contents of the method call may be forwarded through a proxy object of the proxy class according to a preset mapping relationship. The content of the method call can be understood as the information of the method name, the package name, the path and the like. The mapping relationship may be preset according to the requirements of the host APP and the SDK, and includes a corresponding relationship between the platform interface and the application interface on the host APP. The mapping relationship may be understood as including a plurality of corresponding relationships, each corresponding relationship is a key-value pair (i.e., key-value), a "key" is one interface of the platform interfaces, and a "value" is one or more corresponding interfaces of the application interfaces.
Specifically, when the content called by the method is forwarded, if the agent class is a static agent class, the second interface corresponding to the first interface may be determined through a mapping relationship, and then an agent object corresponding to the host APP is created through a newProxyInstance method of the Proxy class, or the agent object may be created in a manner that an APT (association Processing Tool, chinese) reads in a source code. And finally, forwarding the content of the method call from the first interface to the second interface through the proxy object. When the content of the method call is forwarded, if the proxy class is a dynamic proxy class, a proxy object can be created according to the mapping relation, the proxy object contains a key as a first interface and a value as a corresponding relation of a second interface, and then the content of the method call is forwarded from the first interface to the second interface through the proxy object. After the content of the method call is forwarded to the second interface from the first interface, the host APP realizes the method call according to the content of the method call, and further, the content returned by the method call can be forwarded to the first interface from the second interface through the proxy object, so that the SDK processes or stores the content returned by the method call.
The method and the device package the platform interface of the SDK by creating the proxy class, and realize the forwarding of the platform interface on the SDK to the application interface on the host APP according to the preset mapping relation. Therefore, the platform interface is isolated from the application interface, so that the SDK does not need to pay attention to the application interface when the execution method is called, the host APP does not need to pay attention to the platform interface when the implementation method is called, the association degree between the SDK and the host APP can be reduced, and the SDK and the host APP are decoupled. Moreover, the difficulty of writing by developers is reduced, a large amount of empty realization in codes is avoided, and the codes are simplified, so that the constraint capacity and the unified standard of the codes are ensured, and the aim of improving the efficiency of development and maintenance is fulfilled.
In summary, in the present disclosure, an agent class capable of implementing a platform interface on an SDK is first created, and then when a method call of a first interface in the platform interface is executed, content of the method call is forwarded from the first interface to a second interface according to a preset mapping relationship through an agent object of the agent class, so that a host APP accessing the SDK implements the method call, where the mapping relationship includes a correspondence relationship between the platform interface and an application interface on the host APP, and the second interface is an interface corresponding to the first interface and indicated by the mapping relationship in the application interface. According to the method and the device, forwarding of the platform interface on the SDK to the application interface on the host APP is achieved according to the mapping relation through the proxy class, the SDK does not need to pay attention to the application interface when the execution method is called, the host APP does not need to pay attention to the platform interface when the implementation method is called, the association degree between the SDK and the host APP can be reduced, the compiling difficulty is reduced, and the developing and maintaining efficiency is improved.
Fig. 3 is a flowchart illustrating another interface control method according to an exemplary embodiment, where, as shown in fig. 3, the proxy class is a dynamic proxy class, and the proxy object is a dynamic proxy object. Accordingly, step 102 may include:
step 1021, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation when executing the method call.
At step 1022, the contents of the method call are forwarded from the first interface to the second interface via the dynamic proxy object.
In an application scenario where the proxy class is a dynamic proxy class (e.g., a dynamic proxy class), a dynamic proxy object may be created by means of dynamic loading. For example, a dynamic proxy object may be dynamically loaded according to a mapping relationship, where the dynamic proxy object includes a mapping relationship in which a "key" is a first interface and a "value" is a corresponding relationship of a second interface, and finally, content of a method call is forwarded from the first interface to the second interface through the dynamic proxy object.
Fig. 4 is a flowchart illustrating another interface control method according to an exemplary embodiment, and as shown in fig. 4, in a scenario where there are multiple hosts APP, the implementation manner of step 102 may include the following steps:
and 1023, when the method is called, determining a second interface corresponding to the first interface according to the mapping relation, and determining a target host APP to which the second interface belongs.
Step 1024, forwarding the content of the method call from the first interface to the second interface according to the mapping relationship through the target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
For example, a plurality of host APPs may be accessed to one SDK, and when the method is invoked, the second interface corresponding to the first interface may be determined according to the mapping relationship, and the target host APP to which the second interface belongs may be further determined. It should be noted that, in the application interface, the second interface is indicated by the mapping relationship, and may be one or multiple interfaces corresponding to the first interface, that is, one or multiple interfaces corresponding to the first interface may be provided. Correspondingly, the number of the target host APPs may be one or more, that is, one or more host APPs that need to be interfaced with the first interface may be provided. For example, N host APPs are accessed to the SDK, where M (M ≦ N) host APPs need to be interfaced with the first interface, then in the mapping relationship, a "key" may be included as a corresponding relationship of the first interface, and a "value" in the corresponding relationship includes multiple application interfaces, all of which are used as the second interface. The method may also include a plurality of mapping relationships, each mapping relationship includes the first interface and a corresponding application interface, and the application interfaces in the plurality of mapping relationships are all used as the second interfaces.
After the second interface and the target host APP are determined, the content of the method call can be forwarded from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP can realize the method call. Specifically, if the agent class is a static agent class, the method for determining the target agent object may be to create an agent object corresponding to each host APP in advance, then use the agent object corresponding to the target host APP as the target agent object, and finally forward the content of the method call from the first interface to the second interface through the target agent object. If the proxy class is a dynamic proxy class, a target proxy object corresponding to the target host APP can be dynamically loaded according to the corresponding relation between the first interface and the second interface, and then the content of the method call is forwarded from the first interface to the second interface through the target proxy object.
Fig. 5 is a flowchart illustrating another interface control method according to an exemplary embodiment, as shown in fig. 5, after step 101, the method further includes:
and 103, caching the proxy object corresponding to each host APP in the proxy class.
For example, after the proxy class is created, before the method call of the first interface is executed, the proxy object corresponding to each host APP may be cached. Because the SDK may execute multiple method calls during running, in order to avoid repeatedly creating proxy objects each time a method call is executed, the proxy objects may be cached first, for example, according to the format of the weakhosmap. Since there may be multiple host APPs, there may be multiple corresponding proxy objects, and the proxy object corresponding to each host APP may be cached.
Fig. 6 is a flowchart illustrating another interface control method according to an exemplary embodiment, as shown in fig. 6, the method further including:
and step 104, updating the proxy class according to the newly-established third interface in the platform interface so that the proxy class comprises the implementation of the third interface.
And 105, taking the third interface and the fourth interface as a corresponding relation, and adding the corresponding relation to the mapping relation, wherein the fourth interface is an interface which is newly established in an application interface on the host APP and corresponds to the third interface, and the fourth interface is used for realizing method calling of the third interface.
For example, during the use and maintenance of the SDK, there may be a need to add a specific interface to some host APPs, in this case, only a third interface needs to be newly created in the platform interface of the SDK, and the agent class is updated according to the third interface, so that the agent class includes the implementation of the third interface, that is, the implementation of the third interface is added in the agent class, where the third interface may be one or more. And then, updating the mapping relationship, and adding the third interface and the fourth interface as a corresponding relationship to the mapping relationship, namely, taking the 'key' as the third interface and taking the 'value' as the key value of the fourth interface to add the mapping relationship. The fourth interface is a newly-established interface in an application interface on the host APP, corresponds to the third interface, and needs to be implemented by adding the fourth interface on the host APP, so as to implement method invocation of the third interface. Like this, at the in-process of development or maintenance, if need increase the interface, need not all to change every host APP, only need to carry out the realization of butt joint to the host APP who docks with newly-increased interface, add newly-increased interface to update agent class and mapping relation can realize, further improved the efficiency of development and maintenance.
In summary, in the present disclosure, an agent class capable of implementing a platform interface on an SDK is first created, and then when a method call of a first interface in the platform interface is executed, content of the method call is forwarded from the first interface to a second interface according to a preset mapping relationship through an agent object of the agent class, so that a host APP accessing the SDK implements the method call, where the mapping relationship includes a correspondence relationship between the platform interface and an application interface on the host APP, and the second interface is an interface corresponding to the first interface and indicated by the mapping relationship in the application interface. According to the method and the device, forwarding of the platform interface on the SDK to the application interface on the host APP is achieved according to the mapping relation through the proxy class, the SDK does not need to pay attention to the application interface when the execution method is called, the host APP does not need to pay attention to the platform interface when the implementation method is called, the association degree between the SDK and the host APP can be reduced, the compiling difficulty is reduced, and the developing and maintaining efficiency is improved.
Fig. 7 is a block diagram of a control apparatus of an interface according to an exemplary embodiment, as shown in fig. 7, the apparatus is applied to an SDK, a host APP is accessed on the SDK, and the apparatus 200 includes:
the creating module 201 is configured to create an agent class, where the agent class is used to implement a platform interface on the SDK.
The forwarding module 202 is configured to forward, when executing the method call of the first interface, the content of the method call from the first interface to the second interface according to a preset mapping relationship through the proxy object of the proxy class, so that the host APP implements the method call.
The mapping relation comprises a platform interface and a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any interface in the platform interface, and the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
Optionally, the proxy class is a dynamic proxy class, and the proxy object is a dynamic proxy object. The forwarding module 202 is configured to:
and when the method is called, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation. The contents of the method call are forwarded from the first interface to the second interface through the dynamic proxy object.
Fig. 8 is a block diagram illustrating another interface control apparatus according to an exemplary embodiment, where, as shown in fig. 8, in a scenario where host APPs are multiple, the forwarding module 202 includes:
the determining submodule 2021 is configured to determine, according to the mapping relationship, a second interface corresponding to the first interface when the method is invoked, and determine a target host APP to which the second interface belongs.
The forwarding sub-module 2022 is configured to forward, according to the mapping relationship, the content of the method call from the first interface to the second interface through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
Fig. 9 is a block diagram illustrating another interface control apparatus according to an exemplary embodiment, and as shown in fig. 9, the apparatus 200 further includes:
the caching module 203 is configured to cache, in the proxy class, a proxy object corresponding to each host APP after the proxy class is created.
Fig. 10 is a block diagram illustrating another interface control apparatus according to an exemplary embodiment, and as shown in fig. 10, the apparatus 200 further includes:
and the new creation module 204 is configured to update the agent class according to the third interface newly created in the platform interface, so that the agent class includes implementation of the third interface.
An adding module 205, configured to add the third interface and the fourth interface to the mapping relationship as a corresponding relationship, where the fourth interface is an interface that is newly created in an application interface on the host APP and corresponds to the third interface, and the fourth interface is used to implement method invocation of the third interface.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In summary, in the present disclosure, an agent class capable of implementing a platform interface on an SDK is first created, and then when a method call of a first interface in the platform interface is executed, content of the method call is forwarded from the first interface to a second interface according to a preset mapping relationship through an agent object of the agent class, so that a host APP accessing the SDK implements the method call, where the mapping relationship includes a correspondence relationship between the platform interface and an application interface on the host APP, and the second interface is an interface corresponding to the first interface and indicated by the mapping relationship in the application interface. According to the method and the device, forwarding of the platform interface on the SDK to the application interface on the host APP is achieved according to the mapping relation through the proxy class, the SDK does not need to pay attention to the application interface when the execution method is called, the host APP does not need to pay attention to the platform interface when the implementation method is called, the association degree between the SDK and the host APP can be reduced, the compiling difficulty is reduced, and the developing and maintaining efficiency is improved.
Referring now to fig. 11, a schematic diagram of an electronic device (which may comprise, for example, a terminal device or a server) 300 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The SDK in the embodiment of the present disclosure may be deployed on the server, and the host APP may be deployed on the terminal device. The electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 11, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc., output devices 307 including, for example, a liquid crystal display (L CD), speaker, vibrator, etc., storage devices 308 including, for example, magnetic tape, hard disk, etc., and communication devices 309, communication devices 309 may allow electronic apparatus 300 to communicate wirelessly or wiredly with other devices to exchange data.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the terminal devices used to deploy the host APP, the servers used to deploy the SDK, and the like may communicate using any currently known or future developed network Protocol, such as HTTP (Hypertext Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). examples of communications networks include local area networks ("L AN"), wide area networks ("WAN"), Internet networks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), and any currently known or future developed networks.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: creating an agent class, wherein the agent class is used for realizing a platform interface on the SDK; when executing method call of a first interface, forwarding the content of the method call from the first interface to a second interface according to a preset mapping relation through a proxy object of the proxy class so as to enable the host APP to realize the method call; the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including but not limited to AN object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a module does not in some cases constitute a limitation on the module itself, for example, a create module may also be described as a "create proxy class module".
For example, without limitation, exemplary types of hardware logic that may be used include Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CP L D), and so forth.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, example 1 provides a control method of an interface, which is applied to a software development kit SDK, where a host application APP is accessed to the SDK, and the method includes: creating an agent class, wherein the agent class is used for realizing a platform interface on the SDK; when executing method call of a first interface, forwarding the content of the method call from the first interface to a second interface according to a preset mapping relation through a proxy object of the proxy class so as to enable the host APP to realize the method call; the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
Example 2 provides the method of example 1, the proxy class being a dynamic proxy class, the proxy object being a dynamic proxy object; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including: when the method is called, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation; forwarding, by the dynamic proxy object, content of the method call from the first interface to the second interface.
Example 3 provides the method of example 1 or 2, the host APP being a plurality, in accordance with one or more embodiments of the present disclosure; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including: when the method is called, determining the second interface corresponding to the first interface according to the mapping relation, and determining a target host APP to which the second interface belongs; and forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
Example 4 provides the method of example 3, after the creating the proxy class, further comprising: and caching the proxy object corresponding to each host APP in the proxy class.
Example 5 provides the method of example 1, further comprising, in accordance with one or more embodiments of the present disclosure: updating the proxy class according to a newly-built third interface in the platform interface so that the proxy class comprises the implementation of the third interface; and taking the third interface and a fourth interface as a corresponding relation, and adding the corresponding relation to the mapping relation, wherein the fourth interface is an interface which is newly established in the application interface on the host APP and corresponds to the third interface, and the fourth interface is used for realizing method calling of the third interface.
Example 6 provides, according to one or more embodiments of the present disclosure, a control apparatus of an interface, applied to a software development kit SDK, where a host application APP is accessed to the SDK, the apparatus including: a creating module, configured to create an agent class, where the agent class is used to implement a platform interface on the SDK; a forwarding module, configured to forward, when executing a method call of a first interface, content of the method call from the first interface to a second interface according to a preset mapping relationship through a proxy object of the proxy class, so that the host APP implements the method call; the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
Example 7 provides the apparatus of example 6, the proxy class being a dynamic proxy class, the proxy object being a dynamic proxy object, in accordance with one or more embodiments of the present disclosure; the forwarding module is configured to: when the method is called, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation; forwarding, by the dynamic proxy object, content of the method call from the first interface to the second interface.
Example 8 provides the apparatus of example 6 or 7, the host APP being a plurality, in accordance with one or more embodiments of the present disclosure; the forwarding module includes: the determining submodule is used for determining the second interface corresponding to the first interface according to the mapping relation and determining a target host APP to which the second interface belongs when the method is called; and the forwarding sub-module is used for forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
Example 9 provides a computer readable medium having stored thereon a computer program that, when executed by a processing apparatus, implements the steps of the methods of examples 1-5, in accordance with one or more embodiments of the present disclosure.
Example 10 provides, in accordance with one or more embodiments of the present disclosure, an electronic device comprising: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to implement the steps of the methods of examples 1 to 5.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims (10)

1. A control method of an interface is applied to a Software Development Kit (SDK), wherein a host application program (APP) is accessed to the SDK, and the method comprises the following steps:
creating an agent class, wherein the agent class is used for realizing a platform interface on the SDK;
when executing method call of a first interface, forwarding the content of the method call from the first interface to a second interface according to a preset mapping relation through a proxy object of the proxy class so as to enable the host APP to realize the method call;
the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
2. The method of claim 1, wherein the proxy class is a dynamic proxy class and the proxy object is a dynamic proxy object; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including:
when the method is called, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation;
forwarding, by the dynamic proxy object, content of the method call from the first interface to the second interface.
3. The method according to claim 1 or 2, characterized in that said host APP is plural; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including:
when the method is called, determining the second interface corresponding to the first interface according to the mapping relation, and determining a target host APP to which the second interface belongs;
and forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
4. The method of claim 3, wherein after the creating the proxy class, the method further comprises:
and caching the proxy object corresponding to each host APP in the proxy class.
5. The method of claim 1, further comprising:
updating the proxy class according to a newly-built third interface in the platform interface so that the proxy class comprises the implementation of the third interface;
and taking the third interface and a fourth interface as a corresponding relation, and adding the corresponding relation to the mapping relation, wherein the fourth interface is an interface which is newly established in the application interface on the host APP and corresponds to the third interface, and the fourth interface is used for realizing method calling of the third interface.
6. A control device of an interface, which is applied to a Software Development Kit (SDK), wherein a host application program (APP) is accessed to the SDK, and the device comprises:
a creating module, configured to create an agent class, where the agent class is used to implement a platform interface on the SDK;
a forwarding module, configured to forward, when executing a method call of a first interface, content of the method call from the first interface to a second interface according to a preset mapping relationship through a proxy object of the proxy class, so that the host APP implements the method call;
the mapping relation comprises a corresponding relation between the platform interface and an application interface on the host APP, the first interface is any one of the platform interfaces, the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface in the application interface.
7. The apparatus of claim 6, wherein the proxy class is a dynamic proxy class, and the proxy object is a dynamic proxy object; the forwarding module is configured to:
when the method is called, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation; forwarding, by the dynamic proxy object, content of the method call from the first interface to the second interface.
8. The device according to claim 6 or 7, characterized in that said host APP is plural; the forwarding module includes:
the determining submodule is used for determining the second interface corresponding to the first interface according to the mapping relation and determining a target host APP to which the second interface belongs when the method is called;
and the forwarding sub-module is used for forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
9. A computer-readable medium, on which a computer program is stored, characterized in that the program, when being executed by processing means, carries out the steps of the method of any one of claims 1 to 5.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to carry out the steps of the method according to any one of claims 1 to 5.
CN202010187235.1A 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment Active CN111400068B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010187235.1A CN111400068B (en) 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010187235.1A CN111400068B (en) 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111400068A true CN111400068A (en) 2020-07-10
CN111400068B CN111400068B (en) 2023-09-22

Family

ID=71434336

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010187235.1A Active CN111400068B (en) 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111400068B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112068903A (en) * 2020-09-21 2020-12-11 深圳市欢太科技有限公司 Application loading method, application loading device, medium and equipment
CN112463128A (en) * 2020-12-08 2021-03-09 北京指掌易科技有限公司 Software development kit behavior control method and device
CN112486826A (en) * 2020-11-30 2021-03-12 北京字跳网络技术有限公司 Test method, test device, electronic equipment and computer readable medium
CN112068903B (en) * 2020-09-21 2024-05-03 深圳市欢太科技有限公司 Application program loading method, application program loading device, medium and equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294710A1 (en) * 2006-06-19 2007-12-20 Alps Automotive Inc. Simple bluetooth software development kit
CN104965722A (en) * 2014-07-29 2015-10-07 腾讯科技(深圳)有限公司 Method and apparatus for displaying information
US20160099956A1 (en) * 2014-10-07 2016-04-07 Skycure Ltd. Detection of Mutated Apps and Usage Thereof
CN106528304A (en) * 2016-10-31 2017-03-22 努比亚技术有限公司 Shared adapter, configuration method and calling method and device thereof and mobile terminal
CN108958842A (en) * 2018-07-12 2018-12-07 北京猫眼文化传媒有限公司 The business plug-in unit application method of application program and application program
US20190018558A1 (en) * 2017-07-13 2019-01-17 Maoxiao PENG Sharing Method of Maintaining Multimedia Information Real-time Display on an Intelligent Terminal
CN109582400A (en) * 2018-11-30 2019-04-05 北京小米移动软件有限公司 Routine call method and device
CN109710333A (en) * 2018-12-28 2019-05-03 上海掌门科技有限公司 Processing method, equipment and the computer readable storage medium of boarding application

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294710A1 (en) * 2006-06-19 2007-12-20 Alps Automotive Inc. Simple bluetooth software development kit
CN104965722A (en) * 2014-07-29 2015-10-07 腾讯科技(深圳)有限公司 Method and apparatus for displaying information
US20160099956A1 (en) * 2014-10-07 2016-04-07 Skycure Ltd. Detection of Mutated Apps and Usage Thereof
CN106528304A (en) * 2016-10-31 2017-03-22 努比亚技术有限公司 Shared adapter, configuration method and calling method and device thereof and mobile terminal
US20190018558A1 (en) * 2017-07-13 2019-01-17 Maoxiao PENG Sharing Method of Maintaining Multimedia Information Real-time Display on an Intelligent Terminal
CN108958842A (en) * 2018-07-12 2018-12-07 北京猫眼文化传媒有限公司 The business plug-in unit application method of application program and application program
CN109582400A (en) * 2018-11-30 2019-04-05 北京小米移动软件有限公司 Routine call method and device
CN109710333A (en) * 2018-12-28 2019-05-03 上海掌门科技有限公司 Processing method, equipment and the computer readable storage medium of boarding application

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112068903A (en) * 2020-09-21 2020-12-11 深圳市欢太科技有限公司 Application loading method, application loading device, medium and equipment
CN112068903B (en) * 2020-09-21 2024-05-03 深圳市欢太科技有限公司 Application program loading method, application program loading device, medium and equipment
CN112486826A (en) * 2020-11-30 2021-03-12 北京字跳网络技术有限公司 Test method, test device, electronic equipment and computer readable medium
CN112463128A (en) * 2020-12-08 2021-03-09 北京指掌易科技有限公司 Software development kit behavior control method and device

Also Published As

Publication number Publication date
CN111400068B (en) 2023-09-22

Similar Documents

Publication Publication Date Title
CN111475235B (en) Acceleration method, device, equipment and storage medium for function calculation cold start
CN111581555B (en) Document loading method, device, equipment and storage medium
CN110865852B (en) Webpage component loading method and device, electronic equipment and storage medium
CN114595065A (en) Data acquisition method and device, storage medium and electronic equipment
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN114625536B (en) Video memory allocation method, device, medium and electronic equipment
CN110960855A (en) Communication protocol code updating method and device, electronic equipment and storage medium
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN113407165B (en) SDK generation and self-upgrade method, device, readable medium and equipment
CN111309304A (en) Method, device, medium and electronic equipment for generating IDL file
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN112306685B (en) Task isolation method, device, electronic equipment and computer readable medium
CN109614089B (en) Automatic generation method, device, equipment and storage medium of data access code
CN111506904A (en) Method and device for online vulnerability repair
CN113518183B (en) Camera calling method and device and electronic equipment
CN111258786B (en) Decoupling method, device, terminal and storage medium in layered architecture
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium
CN113391860A (en) Service request processing method and device, electronic equipment and computer storage medium
CN111796865A (en) Byte code file modification method and device, terminal equipment and medium
CN111459893A (en) File processing method and device and electronic equipment
CN111324336A (en) Method, device, terminal and storage medium for realizing dependency injection
CN111240657A (en) Method and device for generating SDK and electronic equipment
CN112445820A (en) Data conversion method and device
CN113448550B (en) Method and device for realizing collection management of classes, electronic equipment and computer medium
CN112688863B (en) Gateway data processing method and device and electronic equipment

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