Protocol calling method, device, system, equipment and medium for hybrid development mode
By using middleware to uniformly handle the interactive processes of Hybrid and ReactNative when upgrading or modifying the Native side code, the problem of the interaction processes of Hybrid and ReactNative needs to be modified simultaneously is solved, and the code decoupling and unified management is realized, which reduces development costs.
Patent Information
- Application Number
- CN202011281263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-16
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2040-11-16
AI Technical Summary
When upgrading or modifying the Native side code, the interactive process of Hybrid and ReactNative hybrid mode needs to be modified simultaneously, resulting in high maintenance costs.
By obtaining the protocol communication parameters in the scheduling request, determining the keywords of the native interaction behavior that need to be called, and finding the corresponding interaction protocol, and initiating a call to the protocol. This method uses middleware to uniform format and interactive forwarding of the interactive process, realizing a set of native code to provide interactive processes of multiple protocol types.
Reduces modification of Hybrid and ReactNative interactive processes, reduces development costs, improves development efficiency, and implements code decoupling and unified management.
Smart Images

Figure CN112394915B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of terminal technology, and in particular to a protocol calling method, device, system, electronic device and storage medium in a hybrid development mode. Background Art
[0002] With the development of terminal technology, in order to meet the business needs of rapid iteration of applications (App, Application), Che Shangtong App usually adopts a mixed development model of Native and Hybrid, where Native is the development of Android native mobile applications, while Hybrid is the development of hybrid mode mobile applications, which are specifically embedded in the App and developed through browser web pages. Because Hybrid has many shortcomings in performance, loading speed, etc., ReactNative was introduced. React Native is one of the popular cross-platform mobile application development frameworks. However, since the interaction processes of Hybrid and ReactNative are basically the same in logic, and the functional implementations of Native and ReactNative are also basically the same, when the Android Native side code is upgraded or modified, it is necessary to modify both the Hybrid and ReactNative interaction processes at the same time, resulting in high maintenance costs.
[0003] Therefore, when the Native side code is upgraded or modified, how to reduce the modification of the interaction process of the Hybrid and ReactNative mixed modes and reduce the development cost is a technical problem that needs to be solved. Summary of the invention
[0004] The present invention provides a protocol calling method, device, system, electronic device and storage medium of a hybrid development mode, so as to at least solve the technical problem in the related art that when the Native side code is upgraded or modified, the interaction process of the Hybrid and ReactNative hybrid modes is added, resulting in increased development costs.
[0005] The technical solution of the present invention is as follows:
[0006] According to a first aspect of an embodiment of the present invention, a protocol calling method in a hybrid development mode is provided, comprising:
[0007] Obtaining a scheduling request, the scheduling request including: protocol communication parameters;
[0008] Determine the keyword key of the native interaction behavior nativeAction to be called according to the protocol communication parameters in the scheduling request;
[0009] If the corresponding interaction protocol is found according to the keyword key of the native Action called as needed;
[0010] A call is initiated to the found interaction protocol.
[0011] Optionally, the keyword key of the native action to be called according to the protocol communication parameters in the scheduling request includes:
[0012] Parsing the protocol communication parameters in the scheduling request to obtain the protocol service type to be called;
[0013] Obtain the mapping relationship between the interaction protocols supported by the current scheduling operating system and the corresponding protocol business types by compiling the annotation processor;
[0014] The mapping relationship is searched according to the protocol service type to be called, and the keyword key of the native action to be called is obtained.
[0015] Optionally, before obtaining the scheduling request, the method further includes:
[0016] A mapping relationship between multiple interaction protocols and corresponding protocol business types is pre-established, wherein the multiple interaction protocols include at least: an interaction protocol of a hybrid mode mobile application Hybr id APP and an interaction protocol of a cross-platform mobile application development framework application ReactNat i ve APP.
[0017] Optionally, before initiating a call to the interactive protocol, the method further includes:
[0018] By inheriting the class library, the application programming interface API that calls the operating system is encapsulated;
[0019] The initiating a call to the interactive protocol specifically includes:
[0020] The encapsulated application programming interface API is used to initiate a call to the corresponding interactive protocol.
[0021] According to a second aspect of an embodiment of the present invention, a protocol calling device in a hybrid development mode is provided, comprising:
[0022] A first acquisition module is configured to execute acquisition of a scheduling request, wherein the scheduling request includes: a protocol communication parameter;
[0023] A determination module is configured to determine a keyword key of a native action to be called according to the protocol communication parameters in the scheduling request;
[0024] A search module, configured to execute the keyword key of the native Action called as needed to search for a corresponding interaction protocol;
[0025] The calling module is configured to initiate a call to the interactive protocol found by the searching module.
[0026] Optionally, the determining module includes:
[0027] A parsing module is configured to parse the protocol communication parameters in the scheduling request to obtain the protocol service type to be called;
[0028] A second acquisition module is configured to execute a mapping relationship between supported interaction protocols and corresponding protocol business types by compiling an annotation processor;
[0029] The keyword search module is configured to search the mapping relationship according to the protocol service type that needs to be called, and obtain the keyword key of the native action that needs to be called.
[0030] Optionally, the device further comprises:
[0031] An establishing module is configured to execute, before the first acquiring module acquires the scheduling request, pre-establishing a mapping relationship between a plurality of interactive protocols and corresponding protocol service types, wherein the plurality of interactive protocols at least include: an interactive protocol of a hybrid mode mobile application Hybr id APP and an interactive protocol of a cross-platform mobile application development framework application ReactNative APP;
[0032] Optionally, the device further comprises:
[0033] The encapsulation module is configured to encapsulate the application programming interface API of the operating system by inheriting the class library before the calling module initiates a call to the interactive protocol;
[0034] The calling module is specifically configured to execute the application programming interface API encapsulated by the encapsulation module to initiate a call to the corresponding interactive protocol.
[0035] According to a third aspect of an embodiment of the present invention, a protocol calling system of a hybrid development mode is provided, comprising: a request management module, a middleware module, a calling module, an interaction management module, an interaction module and a callback module connected to each other in sequence, wherein:
[0036] The request management module is configured to execute, upon receiving a scheduling request, sending the scheduling request to the middleware module, wherein the scheduling request includes: protocol communication parameters;
[0037] The middleware module is configured to determine the keyword key of the native action to be called according to the protocol communication parameters in the received scheduling request; and find the corresponding interaction protocol according to the keyword key of the nativeAction to be called; and send the found interaction protocol to the calling module;
[0038] The calling module is configured to execute forwarding the received interaction protocol to the interaction management module;
[0039] The interaction management module is configured to execute forwarding the received interaction protocol to the interaction module;
[0040] The interaction module is configured to execute a call to the corresponding interaction protocol;
[0041] The callback module is configured to execute a callback response after detecting that the interaction module has completed calling the ReactNative protocol.
[0042] According to a fourth aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0043] processor;
[0044] a memory for storing instructions executable by the processor;
[0045] Wherein, the processor is configured to execute the instructions to implement the protocol calling method of the hybrid development mode as described above.
[0046] According to a fifth aspect of an embodiment of the present invention, a storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the protocol calling method of the hybrid development mode as described above.
[0047] According to a sixth aspect of an embodiment of the present invention, a computer program product is provided. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any one of the above-mentioned protocol calling methods of the hybrid development mode.
[0048] The technical solution provided by the embodiments of the present invention may at least include the following beneficial effects:
[0049] In an embodiment of the present invention, the keyword of the native interactive behavior to be called is determined according to the obtained protocol communication parameters of the scheduling request; if the corresponding interactive protocol is found according to the keyword of the native interactive behavior to be called, a call is initiated to the interactive protocol found. In other words, the present invention unifies the format and interactive forwarding of the processes of different interactive protocols, so that a set of native code can provide interactive processes of multiple protocol types (such as two sets of interactive protocol processes of Hybrid and ReactNative, etc.), so that R&D can complete business needs without writing or writing a small amount of code, and achieve code decoupling and unified management, thereby improving development efficiency.
[0050] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the description are used to explain the principles of the present invention, and do not constitute improper limitations of the present invention.
[0052] Figure 1 The present invention is a flowchart of a protocol calling method of a hybrid development mode according to an exemplary embodiment.
[0053] Figure 2 The present invention provides a flowchart of an application example of a protocol calling method in a hybrid development mode.
[0054] Figure 3 The present invention is a block diagram of a protocol calling device in a hybrid development mode according to an exemplary embodiment.
[0055] Figure 4 It is a block diagram of a determination module according to an exemplary embodiment.
[0056] Figure 5 It is another block diagram of a protocol calling device in a hybrid development mode according to an exemplary embodiment.
[0057] Figure 6 It is another block diagram of a protocol calling device in a hybrid development mode according to an exemplary embodiment.
[0058] Figure 7 The invention is a block diagram of a protocol calling system of a hybrid development mode according to an exemplary embodiment.
[0059] Figure 8 The present invention is a structural block diagram of an electronic device according to an exemplary embodiment.
[0060] Fig. 9 The present invention is a structural block diagram of a device for protocol calling in a hybrid development mode according to an exemplary embodiment. DETAILED DESCRIPTION
[0061] In order to enable ordinary persons in the art to better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.
[0062] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0063] In order to facilitate understanding of the following embodiments, the following technical terms are first introduced:
[0064] API: Application Programming Interface, an application programming interface, a calling interface left for the application. The application calls the operating system's API to make the operating system execute the application's commands (actions).
[0065] Native: Android native mobile application (App, Application) development.
[0066] Hybrid: Hybrid mode mobile application development, embedded in the App, developed through browser web pages.
[0067] ReactNative: A cross-platform mobile application development framework. Facebook discovered that Hybrid Apps have many flaws and deficiencies, so it launched a new open source App development solution. Use JSX language to write native interfaces, and js calls native APIs through JSBridge to render UI interactive communications.
[0068] After understanding the above technical terms, let's refer to the embodiments of the present invention below.
[0069] Figure 1 is a flowchart of a protocol calling method of a hybrid development mode according to an exemplary embodiment. Figure 1 As shown, the protocol calling method of the hybrid development mode is used in the terminal, including the following steps:
[0070] In step 101, a scheduling request is obtained, where the scheduling request includes: protocol communication parameters.
[0071] In step 102, a keyword (key) of a native action (native Action) to be called is determined according to the protocol communication parameters in the scheduling request.
[0072] In step 103, the corresponding interaction protocol is found according to the key of the native interaction behavior (native Action) to be called.
[0073] In step 104, a call is initiated to the found interaction protocol.
[0074] The protocol calling method of the hybrid development mode described in the present invention can be applied to terminals, servers, etc., without limitation here. Its terminal implementation device can be a smart phone, a laptop computer, a tablet computer and other electronic devices, without limitation here.
[0075] Combine the following Figure 1 , the specific implementation steps of a protocol calling method for a hybrid development mode provided by an embodiment of the present invention are described in detail.
[0076] First, execute step 101 to obtain a scheduling request, where the scheduling request includes: protocol communication parameters;
[0077] In this step, the backend middleware obtains the scheduling request through the request management end, that is, when the request management end receives the scheduling request, it forwards the scheduling request to the request management end. For example, if the request management end receives a call request that needs to call the Hybrid interaction protocol, the call request includes the protocol communication parameters that need to call Hybrid; of course, if the request management end receives a call request that needs to call the ReactNat ive interaction protocol, the call request includes the protocol communication parameters that need to call ReactNat ive.
[0078] Next, executing step 102, determining the keyword key of the native action to be called according to the protocol communication parameters in the scheduling request;
[0079] In this step, one determination method is: after receiving the scheduling request, the back-end middleware parses the protocol communication parameters in the scheduling request to obtain the protocol business type that needs to be called; obtains the mapping relationship between the interactive protocol supported by the scheduling operating system and the corresponding protocol business type by compiling the annotation processor; searches for the mapping relationship according to the protocol business type that needs to be called to obtain the keyword (key, also called key value) of the native interactive behavior (native Action) that needs to be called, where it should be noted that the mapping relationship between the interactive protocol supported by the scheduling operating system and the corresponding protocol business type can be obtained locally or from a third party, and this embodiment does not limit this.
[0080] Next, step 103 is executed, if the corresponding interaction protocol is found according to the keyword key of the native action to be called;
[0081] In this step, the corresponding interaction protocol can be found according to the keyword key of the native Action that needs to be called. In other words, the uniqueness of the protocol call is guaranteed according to the keyword key.
[0082] For example, if, according to the keyword key of the native Action that needs to be called, the interaction protocol of the corresponding Hybrid APP is found; or the interaction protocol of the ReactNat ive APP is found, etc.
[0083] In this embodiment, if the interaction protocol corresponding to the keyword key of the native interaction behavior native Action to be called is not found, the call is received or the existing calling method is used for scheduling. The specific existing scheduling method is already a well-known technology for those skilled in the art and will not be repeated here.
[0084] Finally, step 104 is executed to initiate a call to the interaction protocol found.
[0085] In this step, after finding the interaction protocol corresponding to the Key, the backend middleware initiates a call to the found interaction protocol. Specifically, the call of the interaction protocol can be implemented through the calling end, the interaction management end, and the interaction end in sequence.
[0086] The protocol calling method of the hybrid development mode shown in this exemplary embodiment determines the keyword of the native interactive behavior to be called according to the protocol communication parameters in the obtained scheduling request; if the corresponding interactive protocol is found according to the keyword of the native interactive behavior to be called, then a call is initiated to the interactive protocol found. In other words, the purpose of the present invention is to solve the difference between Hybr id and ReactNat i ve interacting with Nat i ve respectively, unify the format and interactively forward the interactive protocol process through middleware, and realize that a set of Nat i ve code provides interactive processes of multiple types of protocols (such as Hybr id and ReactNat i ve, etc.) at the same time, so that R&D can complete business needs without writing or writing a small amount of code, and achieve code decoupling and unified management, thereby improving development efficiency.
[0087] Optionally, in another embodiment, based on the above embodiment, before obtaining the scheduling request, the method may further include:
[0088] A mapping relationship between multiple interaction protocols and corresponding protocol business types is pre-established, wherein the multiple interaction protocols include at least: an interaction protocol of a hybrid mode mobile application Hybr id APP and an interaction protocol of a cross-platform mobile application development framework application ReactNat i ve APP.
[0089] That is to say, in the process of code development, we rely on this library, inherit the basic interaction (BaseActivity) and implement the necessary methods to handle personalized business. The newly created interaction (Activity) is pre-registered to the middleware (MiddleWare, or middle layer), so that the middleware can pass in different types (type) and unique keywords (KEY) of interaction (Activity) for different business types to ensure the uniqueness of the protocol call. After that, the keyword (key) of the specified method (that is, the native interaction behavior that needs to be called) is called up through the middleware (MiddleWare) as needed to call the newly created interaction Action. In other words, MiddleWare is used to unify the interaction logic in hybrid development, realize the dynamic registration and call of the Native protocol in hybrid development, and a set of Native codes is provided for RN and H5 at the same time, which not only facilitates maintenance and reduces maintenance costs, but also improves work efficiency.
[0090] Optionally, in another embodiment, based on the above embodiment, before initiating a call to the interactive protocol, the method may further include:
[0091] By inheriting the class library, the application programming interface API that calls the operating system is encapsulated;
[0092] The initiating a call to the interactive protocol specifically includes: initiating a call to the corresponding interactive protocol using the encapsulated application programming interface API.
[0093] In the embodiment of the present invention, by inheriting the custom class library and utilizing the unified API encapsulated by MiddleWare, Hybrid and Native can interact, and MiddleWare is dynamically registered and the call is distributed through the Native protocol, so as to shield the differences between Hybrid and ReactNative in interacting with Native during hybrid development, realize code reuse, and facilitate later maintenance, reduce maintenance failure, and improve work efficiency.
[0094] See also Figure 2 , which is a flowchart of an application example of a protocol calling method of a hybrid development mode provided in an embodiment of the present invention. It should be noted that in the embodiment of the present invention, taking the calling of the ReactNative protocol as an example, the entities involved in the method include: RN request manager (RNRequest Manager), middleware (MiddleWare), RN caller (RNcaller), RN interaction manager (RNAction Manager), RN interaction manager (RNAction) and RN callback manager (RNCallBack) as an example, but in actual application, if the Hybrid protocol is called, the corresponding entities should be: Hybrid request manager (Hybrid Request Manager), middleware (MiddleWare), Hybrid caller (Hybrid caller), Hybrid interaction manager (HybridAction Manager), Hybrid interaction manager (HybridAction) and Hybrid callback manager (HybridCallBack) are not limited to this, that is, the corresponding RN is replaced with Hybrid, and the calling process is similar. Specifically, taking the calling of the ReactNative protocol as an example, it specifically includes:
[0095] Step 201: The RN request management terminal receives a dispatch request sent by a user. If the protocol communication parameters in the call request are the protocol communication parameters of ReactNative.
[0096] Step 202: RN requests the management end to forward (dispensed) the scheduling request to the middleware;
[0097] Step 203: the middleware parses the protocol communication parameters in the scheduling request to obtain the protocol service type to be called; specifically, the parsing can be performed through a getParser operation.
[0098] Step 204: The middleware performs compilation annotation processing through a compilation annotation processor (Parser) to obtain a mapping relationship between the interaction protocol supported by the current scheduling operating system and the corresponding protocol service type;
[0099] Step 205: the middleware searches for the mapping relationship according to the protocol service type to be called, and obtains the key of the native action to be called;
[0100] Step 206: The middleware encapsulates the application programming interface API that calls the operating system by inheriting the class library:
[0101] Step 207: the middleware sends a scheduling request including a keyword (key) of the native action to be called to the RN calling end through the encapsulated application programming interface (API);
[0102] That is, a call is initiated to the RN calling end.
[0103] Step 208: the RN calling end forwards the scheduling request including the key of the native action to be called to the RN interaction management end;
[0104] That is, the RN calling end forwards the scheduling request to the RN interaction management end through the getRNActionlmpyKey operation.
[0105] Step 209: the RN interaction management end forwards the scheduling request including the key of the native interaction behavior (native Action) to be called to the RN interaction end;
[0106] That is, initiate interaction (onAction).
[0107] Step 210: The RN interaction end initiates a call to the corresponding ReactNative protocol according to the key of the native interaction behavior (native Action) that needs to be called;
[0108] Step 211: After detecting that the protocol for calling ReactNative is completed, the RN callback end performs a callback response (callback).
[0109] The purpose of the embodiments of the present invention is to resolve the differences in the interactions between Hybrid and ReactNative and Native, unify the format of the interaction process and forward the interaction through middleware, and implement a set of native code to provide both Hybrid and ReactNative interaction processes, so that R&D can meet business needs without writing any more code or only writing a small amount of code, and achieve code decoupling and unified management, thereby improving development efficiency and saving maintenance costs.
[0110] In the embodiment of the present invention, the protocol inherits RNAction and adds the annotation KEY of the protocol. MiddleWare dynamically obtains all Action protocols for unified maintenance and management by compiling the annotation processor. When the protocol is called, the protocol processing with the same key is found through the MiddleWare layer protocol distribution.
[0111] It should be noted that any App based on Android system terminals only needs to inherit this library to realize the interactive process between hybrid development and Native functions.
[0112] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that this implementation disclosure is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention.
[0113] Figure 3 is a block diagram of a protocol calling device in a hybrid development mode according to an exemplary embodiment. Figure 3 The device includes: a first acquisition module 301, a determination module 302, a search module 303 and a call module 304, wherein:
[0114] The first acquisition module 301 is configured to execute acquisition of a scheduling request, wherein the scheduling request includes: protocol communication parameters;
[0115] The determination module 302 is configured to determine a keyword key of a native action to be called according to the protocol communication parameters in the scheduling request;
[0116] The search module 303 is configured to search for a corresponding interaction protocol according to the keyword key of the native Action called as needed;
[0117] The calling module 304 is configured to initiate a call to the interactive protocol found by the searching module.
[0118] Optionally, in another embodiment, based on the above embodiment, the determination module 302 includes: a parsing module 401, a second acquisition module 402 and a keyword search module 403, and its structural diagram is shown as follows: Figure 4 As shown,
[0119] The parsing module 401 is configured to parse the protocol communication parameters in the scheduling request to obtain the protocol service type to be called;
[0120] The second acquisition module 402 is configured to execute the mapping relationship between the supported interaction protocols and the corresponding protocol service types by compiling the annotation processor;
[0121] The keyword search module 403 is configured to search the mapping relationship according to the protocol service type to be called, and obtain the keyword key of the native action to be called.
[0122] Optionally, in another embodiment, based on the above embodiment, the device further includes: establishing module 501, whose structural diagram is as shown in FIG. Figure 5 As shown,
[0123] The establishing module 501 is configured to execute, before the first obtaining module 301 obtains the scheduling request, pre-establishing a mapping relationship between a plurality of interactive protocols and corresponding protocol service types, wherein the plurality of interactive protocols at least include: an interactive protocol of a hybrid mode mobile application Hybr id APP and an interactive protocol of a cross-platform mobile application development framework application ReactNat i ve APP;
[0124] Optionally, in another embodiment, based on the above embodiment, the device may further include: a packaging module 601, whose structural diagram is shown in FIG. Figure 6 As shown,
[0125] The encapsulation module 601 is configured to encapsulate the application programming interface API of the operating system by inheriting the class library before the calling module 304 initiates a call to the interactive protocol;
[0126] The calling module 304 is specifically configured to execute the application programming interface API encapsulated by the encapsulation module 601 to initiate a call to the corresponding interactive protocol.
[0127] Also, see Figure 7, the embodiment of the present invention also provides a protocol calling system of a hybrid development mode, including: a request management module 701, a middleware module 702, a calling module 703, an interaction management module 704, an interaction module 705 and a callback module 706 which are connected to each other in sequence, wherein,
[0128] The request management module 701 is configured to execute, upon receiving a scheduling request, sending the scheduling request to the middleware module 702 , wherein the scheduling request includes: protocol communication parameters;
[0129] The middleware module 702 is configured to determine the keyword key of the native action to be called according to the protocol communication parameters in the received scheduling request; and find the corresponding interaction protocol according to the keyword key of the native action to be called; and send the found interaction protocol to the calling module 703;
[0130] The middleware module determines the keyword key of the native action to be called according to the protocol communication parameters in the scheduling request, including:
[0131] The middleware parses the protocol communication parameters in the scheduling request to obtain the protocol service type that needs to be called; obtains the mapping relationship between the interactive protocols supported by the current scheduling operating system and the corresponding protocol service types by compiling the annotation processor; searches the mapping relationship according to the protocol service type that needs to be called to obtain the keyword key of the native interactive behavior native Action that needs to be called.
[0132] The calling module 703 is configured to forward the received interaction protocol to the interaction management module 704;
[0133] The interaction management module 704 is configured to execute forwarding the received interaction protocol to the interaction module 705;
[0134] The interaction module 705 is configured to execute a call to the corresponding interaction protocol;
[0135] The callback module 706 is configured to execute a callback response after detecting that the interaction module 706 has completed calling the ReactNative protocol.
[0136] Optionally, in another embodiment, based on the above embodiment, the middleware is further configured to execute a pre-established mapping relationship between multiple interaction protocols and corresponding protocol business types, wherein the multiple interaction protocols include at least: an interaction protocol of a hybrid mode mobile application HybridAPP and an interaction protocol of a cross-platform mobile application development framework application ReactNat i ve APP.
[0137] Optionally, in another embodiment, based on the above embodiment, the middleware is further configured to encapsulate the application programming interface API that calls the operating system by inheriting the class library before initiating a call to the interactive protocol; and use the encapsulated application programming interface API to initiate a call to the corresponding interactive protocol.
[0138] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method. For relevant details, please refer to the partial description of the method embodiment, and will not be elaborated here.
[0139] Optionally, in an exemplary embodiment, the present invention further provides an electronic device, including:
[0140] processor;
[0141] a memory for storing instructions executable by the processor;
[0142] Wherein, the processor is configured to execute the instructions to implement the protocol calling method of the hybrid development mode as described above.
[0143] Optionally, in an exemplary embodiment, the present invention further provides a storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the protocol calling method of the hybrid development mode as described above.
[0144] In an exemplary embodiment, the present invention further provides a storage medium including instructions, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to complete the protocol calling method of the above hybrid development mode. Optionally, the storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0145] See also Figure 8, is a block diagram of an electronic device 800 according to an exemplary embodiment. For example, the electronic device 800 may be a mobile terminal or a server, and the electronic device is a mobile terminal as an example for explanation in the embodiment of the present invention. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0146] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0147] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0148] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0149] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0150] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0151] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0152] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0153] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0154] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (I rDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0155] In an exemplary embodiment, the electronic device 800 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the protocol calling method of the hybrid development mode shown above.
[0156] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to complete the protocol calling method of the hybrid development mode shown above. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0157] In an exemplary embodiment, a computer program product is also provided. When instructions in the computer program product are executed by the processor 820 of the electronic device 800, the electronic device 800 executes the protocol calling method of the hybrid development mode shown above.
[0158] Fig. 9 is a block diagram of a device 900 for protocol calling in a hybrid development mode according to an exemplary embodiment. For example, the device 900 may be provided as a server. Fig. 9 The apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions executable by the processing component 922, such as an application. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute instructions to perform the protocol calling method of the hybrid development mode.
[0159] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.
[0160] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0161] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A protocol calling method for a hybrid development mode, characterized in that: include: Obtaining a scheduling request, the scheduling request including: protocol communication parameters; Determine the keyword key of the native action to be called according to the protocol communication parameters in the scheduling request; If the corresponding interaction protocol is found according to the keyword key of the native action called as needed; Initiate a call to the interaction protocol found; The interaction protocol includes at least: an interaction protocol of a hybrid mode mobile application Hybrid APP and an interaction protocol of a cross-platform mobile application development framework application ReactNative APP; The keyword key is used to ensure the uniqueness of the protocol call. The keyword key is obtained by searching for a mapping relationship between an interactive protocol and a corresponding protocol service type according to a protocol service type that needs to be called. The protocol service type is obtained by parsing the protocol communication parameters.
2. The protocol calling method of the hybrid development mode according to claim 1, characterized in that: The keyword key of the native action to be called according to the protocol communication parameters in the scheduling request includes: Parsing the protocol communication parameters in the scheduling request to obtain the protocol service type to be called; Obtain the mapping relationship between the interaction protocols supported by the current scheduling operating system and the corresponding protocol business types by compiling the annotation processor; The mapping relationship is searched according to the protocol service type to be called, and the keyword key of the native action to be called is obtained.
3. The protocol calling method of the hybrid development mode according to claim 2 is characterized in that: Before obtaining the scheduling request, the method further includes: A mapping relationship between multiple interactive protocols and corresponding protocol service types is established in advance.
4. The protocol calling method of the hybrid development mode according to any one of claims 1 to 3, characterized in that: Before initiating a call to the interactive protocol, the method further includes: By inheriting the class library, the API that calls the operating system is encapsulated; The initiating a call to the interactive protocol specifically includes: The encapsulated application programming interface API is used to initiate a call to the corresponding interactive protocol.
5. A protocol calling device for a hybrid development mode, characterized in that: include: A first acquisition module is configured to execute acquisition of a scheduling request, wherein the scheduling request includes: a protocol communication parameter; A determination module is configured to determine a keyword key of a native action to be called according to the protocol communication parameters in the scheduling request; A search module is configured to execute the keyword key of the native action called as needed to search for a corresponding interaction protocol; A calling module, configured to initiate a call to the interactive protocol found by the searching module; The interaction protocol includes at least: an interaction protocol of a hybrid mode mobile application Hybrid APP and an interaction protocol of a cross-platform mobile application development framework application ReactNative APP; The keyword key is used to ensure the uniqueness of the protocol call. The keyword key is obtained by searching for a mapping relationship between an interactive protocol and a corresponding protocol service type according to a protocol service type that needs to be called. The protocol service type is obtained by parsing the protocol communication parameters.
6. The protocol calling device of the hybrid development mode according to claim 5, characterized in that: The determination module comprises: A parsing module is configured to parse the protocol communication parameters in the scheduling request to obtain the protocol service type to be called; A second acquisition module is configured to execute a mapping relationship between supported interaction protocols and corresponding protocol business types by compiling an annotation processor; The keyword search module is configured to search the mapping relationship according to the protocol service type that needs to be called, and obtain the keyword key of the native action that needs to be called.
7. The protocol calling device of the hybrid development mode according to claim 6, characterized in that: The device also includes: The establishing module is configured to pre-establish a mapping relationship between a plurality of interactive protocols and corresponding protocol service types before the first acquiring module acquires the scheduling request.
8. The protocol calling device of the hybrid development mode according to any one of claims 5 to 7, characterized in that: The device also includes: The encapsulation module is configured to encapsulate the application programming interface API of the calling operating system by inheriting the class library before the calling module initiates a call to the interactive protocol; The calling module is specifically configured to execute the application programming interface API encapsulated by the encapsulation module to initiate a call to the corresponding interactive protocol.
9. A protocol calling system of a hybrid development mode, characterized in that: include: The request management module, the middleware module, the calling module, the interaction management module, the interaction module and the callback module are connected to each other in sequence, wherein: The request management module is configured to execute, upon receiving a scheduling request, sending the scheduling request to the middleware module, wherein the scheduling request includes: protocol communication parameters; The middleware module is configured to determine the keyword key of the native action to be called according to the protocol communication parameters in the received scheduling request; and find the corresponding interaction protocol according to the keyword key of the native action to be called; and send the found interaction protocol to the calling module; The calling module is configured to execute forwarding the received interaction protocol to the interaction management module; The interaction management module is configured to execute forwarding the received interaction protocol to the interaction module; The interaction module is configured to execute a call to the corresponding interaction protocol; The callback module is configured to execute a callback response after detecting that the interaction module has completed calling the ReactNative protocol; The interaction protocol includes at least: an interaction protocol of a hybrid mode mobile application Hybrid APP and an interaction protocol of a cross-platform mobile application development framework application ReactNative APP; The keyword key is used to ensure the uniqueness of the protocol call. The keyword key is obtained by searching for a mapping relationship between an interactive protocol and a corresponding protocol service type according to a protocol service type that needs to be called. The protocol service type is obtained by parsing the protocol communication parameters.
10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the protocol calling method of the hybrid development mode as described in any one of claims 1 to 4.
11. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the protocol calling method of the hybrid development mode as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Operation method and device of application program on the basis of application program programming interface
CN105607895A
Hybrid programming method and system for APP (Application) client
CN108572822A
Method for developing mobile office system in mixed mode
CN111782192A