Cross-platform native function calling method and related equipment based on hybrid technology stack

By adopting a cross-platform native function call method based on a hybrid technology stack in the application, and using the encapsulated navigation interface and business driver channel, the inconvenience of existing applications when calling native functions across the platform is solved, achieving lower development and maintenance costs.

CN114741212BActive Publication Date: 2025-03-21CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210209713.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2025-03-21
Estimated Expiration
2042-03-03

AI Technical Summary

Technical Problem

Existing applications are less convenient when calling native functions across platforms, resulting in higher development and maintenance costs.

Method used

The cross-platform native function call method based on the hybrid technology stack is used to obtain the data request of the user's operation page, and the native function is called using the preset encapsulated navigation interface and business driver channel. This method supports the mixed use of a web front-end technology stack and a React Native technology stack.

Benefits of technology

It realizes that applications can call native functions more conveniently on different platforms, reducing development and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741212B_ABST
    Figure CN114741212B_ABST
Patent Text Reader

Abstract

The present invention discloses a cross-platform native function calling method and related equipment based on a hybrid technology stack, which belongs to the field of computer application. It includes: obtaining a user operation page preset in the business layer according to the user's operation instruction; obtaining a data request generated by the user operation page, wherein the data request includes interface parameters and call data information; obtaining an encapsulated navigation interface preset in the component layer according to the interface parameters; obtaining a business drive channel preset in the driver layer according to the encapsulated navigation interface, and the business drive channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer; obtaining a native name preset in the driver layer according to the call data information; calling a native function preset in the native bottom layer according to the native name. The present invention can solve the problem that it is inconvenient for existing applications to call native functions across platforms, thereby making the development cost and maintenance cost of existing applications high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer applications, and in particular relates to a cross-platform native function calling method based on a hybrid technology stack and related equipment. Background Art

[0002] Currently, when running applications (also known as apps) on mobile platforms (such as Android system platforms and iOS system platforms), the applications often need to call native functions (such as obtaining device information, making calls, calling network interfaces, etc.) to support the normal operation of the application, thereby reducing the amount of code development for the application.

[0003] The inventors found that existing applications mainly have the following three ways of calling native functions across platforms: the first way is to call native functions based on the Web kernel (that is, the Web front-end technology stack). The advantage of this way of calling native functions is that there is no need to introduce an external framework, but the disadvantage is that it is inconvenient to use; the second way is to call native functions based on JSBridge encapsulated inside the Web kernel (that is, the Web front-end technology stack). The advantage of this way of calling native functions is that it is easy to use, but the disadvantage is that an external framework is introduced; the third way is to call native functions based on the React Native kernel (that is, the RN kernel). This way of calling native functions has fewer available third-party controls, is heavily dependent on official (Facebook) maintenance, and is less convenient to use.

[0004] The inventors found that the above three methods of calling native functions across platforms have not been integrated together, making it inconvenient for existing applications to call native functions across platforms, which in turn makes the development and maintenance costs of existing applications high, and it is necessary to make improvements. Summary of the invention

[0005] The embodiment of the present invention provides a cross-platform native function calling method and related devices based on a hybrid technology stack to solve the problem that it is inconvenient for existing applications to call native functions across platforms, thereby increasing the development cost and maintenance cost of existing applications.

[0006] The technical solution of the present invention is: a cross-platform native function calling method based on a hybrid technology stack, comprising:

[0007] Acquire a user operation page preset in the business layer according to the user's operation instruction, wherein the user operation page is one of a plurality of first pages based on the Web front-end technology stack, or one of a plurality of second pages based on the React Native technology stack;

[0008] Acquire a data request generated by the user operating the page, wherein the data request includes interface parameters and call data information;

[0009] Acquire a packaged navigation interface preset in the component layer according to the interface parameter, wherein there are multiple packaged navigation interfaces;

[0010] Acquire a business driving channel preset in the driver layer according to the encapsulated navigation interface, wherein the business driving channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer, and the business driving channel includes a first channel based on the Web front-end technology stack and a second channel based on the React Native technology stack;

[0011] Acquire a native name preset in the driver layer according to the call data information, where the native name is a registered name corresponding to a native function capable of implementing the data request;

[0012] The native function preset in the native bottom layer is called according to the native name.

[0013] Optionally, obtaining a business-driven channel preset in a driver layer according to the encapsulated navigation interface includes: obtaining a unified driver entry preset in a driver layer according to the encapsulated navigation interface, the unified driver entry being a method call entry for each of the encapsulated navigation interfaces; parsing the data request through the unified driver entry to obtain a first parsing result; obtaining a bridge protocol that can respond to the data request according to the first parsing result, obtaining a business-driven channel according to the bridge protocol, the bridge protocol including a first protocol based on a Web front-end technology stack, and a second protocol based on a ReactNative technology stack.

[0014] Optionally, obtaining the service-driven channel according to the bridge protocol includes: determining whether the bridge protocol corresponds to the first channel, and if so, using the first channel as the service-driven channel to respond to the data request; if not, using the second channel as the service-driven channel to respond to the data request.

[0015] Optionally, obtaining the native name preset in the preset driver layer according to the calling data information includes: obtaining a unified driver export preset in the driver layer; determining a native function that can implement the data request according to the calling data information; and obtaining the native name preset in the preset driver layer according to the native function.

[0016] Optionally, obtaining the native name preset in the preset driver layer according to the calling data information also includes: determining whether there is a native function corresponding to the native name in the native bottom layer; if so, calling the native function; if not, ending the cross-platform native function calling method based on the hybrid technology stack.

[0017] Optionally, the native function includes multiple native scenario functions set according to different business scenarios. After calling the native function preset in the native bottom layer according to the native name, it also includes: obtaining a native calling interface preset in the native bottom layer and corresponding to the native function according to the native name, there are multiple native calling interfaces, each native calling interface includes multiple native scenario interfaces set according to different business scenarios and corresponding to the native scenario function; obtaining user identity information, and obtaining a native scenario interface according to the user identity information and the native name; obtaining the corresponding native scenario function according to the native scenario interface.

[0018] Optionally, after calling the native function preset in the native bottom layer according to the native name, it also includes: obtaining the execution result of the native function, and returning the execution result to the business-driven channel, the encapsulated navigation interface and the user operation page in sequence according to the bridge protocol.

[0019] Another technical solution of the present invention is: a cross-platform native function calling device based on a hybrid technology stack, comprising:

[0020] A page acquisition module, used to acquire a user operation page preset in the business layer according to the user's operation instruction, wherein the user operation page is one of a plurality of first pages based on the Web front-end technology stack, or one of a plurality of second pages based on the ReactNative technology stack;

[0021] A data request acquisition module, in which a user acquires a data request generated by the user operation page, wherein the data request includes interface parameters and call data information;

[0022] An encapsulated interface acquisition module, used to acquire an encapsulated navigation interface preset in a component layer according to the interface parameters, wherein there are multiple encapsulated navigation interfaces;

[0023] A driving channel acquisition module is used to acquire a business driving channel preset in the driving layer according to the encapsulated navigation interface, wherein the business driving channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer, and the business driving channel includes a first channel based on the Web front-end technology stack and a second channel based on the React Native technology stack;

[0024] A native name acquisition module, used for acquiring a native name preset in the driver layer according to the call data information, wherein the native name is a registered name corresponding to a native function capable of realizing the data request;

[0025] The native function acquisition module is used to call the native function preset in the native bottom layer according to the native name.

[0026] Another technical solution of the present invention is: to provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned cross-platform native function calling method based on a hybrid technology stack when executing the computer program.

[0027] Another technical solution of the present invention is: to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned cross-platform native function calling method based on a hybrid technology stack are implemented.

[0028] The beneficial effects of the present invention are as follows:

[0029] 1. The present invention can determine the type of hybrid technology stack (Web front-end technology stack or React Native technology stack) adopted by the user operation page selected by the user operation instruction, and can determine the native function required to be called to implement the above data request through the data request generated when the user clicks the user operation page. In this way, the present invention can select a suitable encapsulated navigation interface according to the native function to be called, and select a suitable business-driven channel (a first channel based on the Web front-end technology stack or a second channel based on the React Native technology stack) according to the type of hybrid technology stack. The business-driven channel is a communication channel from the encapsulated navigation interface to the preset native name. Finally, the present invention can find the corresponding native function through the above native name, so that the above found native function can realize the data request generated when the user operates the page, so that the application can more conveniently call the native function across platforms, thereby reducing the development cost and maintenance cost of the existing application.

[0030] 2. The unified driver entry can not only serve as a unified interface for all encapsulated navigation interfaces, so that the present invention can more conveniently call native functions, but also parse the data request of the present invention (JSON encode and assemble the data request, etc.), so as to select a suitable bridge protocol, and then select a suitable business-driven channel; the unified driver entry can not only serve as a unified interface for all native functions, so that the present invention can more conveniently select a suitable native name, but also serve as a receiving port for the execution results of all native functions, so that the present invention can more conveniently return the execution results of the above-mentioned native functions to the appropriate business-driven channel. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0032] Figure 1 It is a flowchart of a cross-platform native function calling method based on a hybrid technology stack in the first embodiment of the present invention;

[0033] Figure 2 is a schematic diagram of the structure of a cross-platform communication framework in the first embodiment of the present invention;

[0034] Figure 3 It is a structural schematic diagram of a cross-platform native function calling device based on a hybrid technology stack according to a second embodiment of the present invention;

[0035] Figure 4 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention;

[0036] Figure 5 FIG. 4 is a schematic diagram of the structure of a storage medium according to a fourth embodiment of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The terms "first", "second" and "third" in the present invention are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second" and "third" can explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. All directional indications (such as up, down, left, right, front, back...) in the embodiments of the present invention are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.

[0039] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0040] Figure 1 FIG. 1 is a flow chart of a cross-platform native function calling method based on a hybrid technology stack according to a first embodiment of the present invention. It should be noted that if there is substantially the same result, the method of the present invention is not limited to the above method. Figure 1 The process sequence shown is limited. Figure 1 As shown, the cross-platform native function calling method based on the hybrid technology stack includes the following steps:

[0041] S1. Obtaining a user operation page preset in the business layer according to the user's operation instruction, wherein the user operation page is one of a plurality of first pages based on the Web front-end technology stack, or one of a plurality of second pages based on the React Native technology stack;

[0042] In this embodiment, the operation instruction generated by the user on the application is used to point to a user operation page in the business layer, which can be one of the multiple first pages based on the Web front-end technology stack, or one of the multiple second pages based on the React Native technology stack. The above application can be an application installed on an andriod phone (platform) or an application installed on an IOS phone (platform). At the same time, the application of this application can be a pocket APP, a bank insurance APP, etc.

[0043] In this embodiment, the business layer is arranged on a cross-platform communication framework, and the user's operation instructions contain preset instruction parameters. The instruction parameters can enable different applications (such as Pocket App and Silver Insurance App) to point to a page in the business layer on the cross-platform communication framework (that is, the user operation page, such as the activity page), and can also allow the page (such as the activity page) to return the native functions called in the native bottom layer to the application (such as Pocket App and Silver Insurance App).

[0044] S2. Acquire a data request generated by the user operating the page, wherein the data request includes interface parameters and call data information;

[0045] The data request generated by the user operation page is used to indicate the call to the native function of the mobile platform. The data request includes preset interface parameters and calling data information. The interface parameters mainly correspond to a certain (or several) encapsulated navigation interface preset in the component layer, so that this application can more conveniently find a suitable certain (or several) native function in the native bottom layer; the calling data information mainly corresponds to a certain (or several) native name preset in the driver layer, so that this application can call the corresponding native function.

[0046] In this embodiment, the native function specifically refers to the application function provided by the mobile terminal platform for the mobile terminal, such as obtaining device information, obtaining network information, network interface calling, positioning, making calls, sending text messages and other application functions.

[0047] S3, acquiring a packaged navigation interface preset in the component layer according to the interface parameters, wherein there are multiple packaged navigation interfaces;

[0048] In this step, the data request generated by the user operation page may contain multiple interface parameters, but each interface parameter indicates a unique encapsulated navigation interface. In actual operation, the encapsulated navigation interface is a pre-encapsulated unified interface defined according to the native function. For example, when it is necessary to call a certain native function (such as "make a call"), at this time, no matter which platform the application app is located on (such as Android platform or IOS platform), and no matter what type the application app is (such as Pocket APP or Bank Insurance APP), the application app can and can only complete the call of the native function through a specific encapsulated navigation interface, wherein the above-mentioned specific encapsulated navigation interface corresponds to a certain interface parameter contained in the data request generated by the user operation page.

[0049] The following uses the interface for obtaining user account information (getAccountinfo interface) as an example to explain how this application calls the encapsulated navigation interface: Whether it is the follow-up page based on the React Native technology stack or the cloud interview module based on the Web front-end technology stack, when the user account information needs to be called, this application can and can only call the above user account information through the "get user account information interface" (getAccountinfo interface, that is, the encapsulated navigation interface). In actual work, the interface for obtaining user account information (getAccountinfo interface) in this application can be the user id.

[0050] S4. Acquire a business driving channel preset in the driver layer according to the encapsulated navigation interface, wherein the business driving channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer, and the business driving channel includes a first channel based on the Web front-end technology stack and a second channel based on the React Native technology stack;

[0051] In this embodiment, the native function that implements the data request will correspond to the preset encapsulated navigation interface, and the user operation page that generates the above data request will correspond to the preset business-driven channel. A communication channel is constructed from the encapsulated navigation interface to the native name (that is, the abbreviation of the registered name of the native function) through the business-driven channel, wherein the business-driven channel can be a first channel based on the Web front-end technology stack (also called a Web channel), or a second channel based on the React Native technology stack (also called an RN channel).

[0052] When the user operation page that generates the above data request comes from the first business of the business layer, the first channel (ie, the Web channel) is used; similarly, when the user operation page that generates the above data request comes from the second business of the business layer, the second channel (ie, the RN channel) is used.

[0053] In this step, the step of obtaining the service driving channel preset in the driving layer includes:

[0054] S41, acquiring a unified driver entry preset in a driver layer according to the encapsulated navigation interface, the unified driver entry being a method call entry for each of the encapsulated navigation interfaces;

[0055] In this step, the unified driver entry (nativeCall.JS) is a method entry for unified calls provided to each encapsulated navigation interface (nativeCall, such as moduleName, methodName and callback, etc.). The implementation of the unified driver entry (nativeCall) will find the channel entry of its own technology stack according to the running environment, and then complete the calling channel.

[0056] S42, parsing the data request through the unified driver entry to obtain a first parsing result;

[0057] S43. Acquire a bridge protocol that can respond to the data request according to the first parsing result, and acquire a business-driven channel according to the bridge protocol, wherein the bridge protocol includes a first protocol based on a Web front-end technology stack and a second protocol based on a React Native technology stack.

[0058] In this embodiment, the business-driven channel mainly refers to the communication method between the native technology stack (such as the Web front-end technology stack or the ReactNative technology stack) and the native functions (such as making a call or recording). For example, the first channel (Web channel) can be cordova, JSBridge, or a lower-level addjavaScricptinterface.

[0059] This application does not limit the specific communication type of the business-driven channel. People can choose according to their own needs. You only need to connect to the unified driver entrance and unified driver exit according to the standards of the communication architecture to achieve normal communication. The inventor of this application also went through the process of changing from cordova to JSBridge in actual application.

[0060] Optionally, the step of acquiring a service-driven channel according to the bridge protocol includes:

[0061] S44, determining whether the bridge protocol corresponds to the first channel, if so, using the first channel as a service driving channel to respond to the data request; if not, using the second channel as a service driving channel to respond to the data request.

[0062] The main function of the unified driver export (NativeCallManager) of this application is to distribute requests from the channel, interpret the data from the channel, find the corresponding native module and the native interface under the native module, and return the execution result to the channel after finally calling the native function. Because this application implements management distribution through the unified driver export, the above native name is also in the unified driver export.

[0063] Preferably, the step of obtaining the native name preset in the preset driver layer also includes: obtaining a unified driver export preset in the driver layer; determining a native function that can realize the data request according to the calling data information; and obtaining the native name preset in the preset driver layer according to the native function.

[0064] Preferably, the unified driver entry (nativeCall) is also responsible for JSON encoding and assembly of input data; the unified driver exit (NativeCallManager) is responsible for JSON decoding and splitting of request parameters, as well as registration and distribution of modules.

[0065] Furthermore, the present application can also parse the request of the application, obtain the request parsing result, and call the corresponding native function according to the request parsing result. This part of the content can be implemented in step S2 (by presetting the corresponding interface parameters and calling data information in the data request) or in step S4 (through a unified driver entry), and people can choose according to their needs.

[0066] S5. Acquire a native name preset in the driver layer according to the call data information, where the native name is a registered name corresponding to a native function capable of implementing the data request;

[0067] In this step, when different types of applications (such as Pocket App and Yinbao App) call the same native function, their call data information is consistent, so that the data requests generated by different types of applications can correspond to specific encapsulated navigation interfaces, native names, and native functions. For example, the call data information corresponding to the "make a call" function on the Android system platform is 1, and the call data information corresponding to the "make a call" function on the iOS system platform is also 1, and the call data information of the above-mentioned "make a call" native function in Pocket App and Yinbao App is also 1, and the call data information corresponding to the native name is still 1.

[0068] In this embodiment, no matter which platform (such as Android platform or IOS platform) the application (such as Pocket App and Bank Insurance App) is located on, and no matter what type of application app it is (such as Pocket App or Bank Insurance App), the application (such as Pocket App and Bank Insurance App) can and can only complete the call of native functions through a specific native name, where the above-mentioned specific native name corresponds to a specific encapsulated navigation interface.

[0069] S6. Call the native function preset in the native bottom layer according to the native name.

[0070] Optionally, the step of calling the native function preset in the native bottom layer includes: determining whether there is a native function corresponding to the native name in the native bottom layer; if so, calling the native function; if not, ending the above steps S1 to S6. Preferably, in this example, if there is no corresponding native function in the native bottom layer, the present invention can also access the corresponding native function (that is, the native function on the native bottom layer of the non-cross-platform communication framework located on the third-party platform) through the native interface preset on the native bottom layer.

[0071] Preferably, after calling the native function preset in the native bottom layer, it also includes: obtaining the execution result of the native function, and returning the execution result to the business-driven channel, the encapsulated navigation interface and the user operation page in sequence according to the bridge protocol.

[0072] In this embodiment, the calling data information will eventually find the corresponding native name at the unified driver exit through the corresponding technology stack channel (the first channel or the second channel), and will be distributed to the native bottom layer by the unified driver exit (NativeCallManager) according to the above native name to call the corresponding native function (module and method). The execution result of calling the above native function will be returned to the driver layer, component layer, business layer and application in turn.

[0073] In this embodiment, the native function is set on the native bottom layer of the cross-platform communication framework. The native bottom layer of the present application provides a set of default implementations, such as network requests, account information and other methods in the interview module. At the same time, the present invention can also implement different modules and methods for different business scenarios by the business party, and inject them into the driver layer. In this way, the present invention no longer needs to implement a set of modules and methods for different technology stacks respectively, saving software development costs and maintenance costs.

[0074] Furthermore, after calling the native function preset in the native bottom layer according to the native name, since the native function can be further subdivided into multiple native scenario functions set according to different business scenarios, the step of obtaining corresponding native scenario functions for different business scenarios includes: obtaining a native calling interface preset in the native bottom layer and corresponding to the native function according to the native name, there are multiple native calling interfaces, each native calling interface includes multiple native scenario interfaces set according to different business scenarios and corresponding to the native scenario function; obtaining user identity information, and obtaining a native scenario interface according to the user identity information and the native name; obtaining the corresponding native scenario function according to the native scenario interface.

[0075] The above-mentioned default implementation mainly refers to the default implementation of common modules and functions. The native name can be a unified registered name corresponding to a native function (that is, the native name, corresponding to the native calling interface), and can further be a registered name corresponding to a business scenario (a business scenario name under the same native name, corresponding to the native scenario interface and native scenario function).

[0076] For example, no matter what business needs to know who the user is, a user identifier, that is, a user id, is required. In order to smooth out the differences in callers, this application sets up a common module (that is, a native call interface) to obtain the user information structure (getAccountInfo interface), among which the user id can be obtained by default in the data request.

[0077] Because the cross-platform communication framework (that is, the software development kit sdk) of the present application runs in different applications (apps), the user information is different in different applications (apps). For example, if the application (app) is developed for insurance agents, the user information includes the sales department information and subsidiary information, etc. If the application (app) is for customers, the user information may not contain this information (sales department information and subsidiary information), only the customer's own identity information.

[0078] Therefore, the default implementation of the common module (that is, the native call interface) cannot meet the needs of all business applications (apps) (that is, when obtaining user information, the common module alone cannot further distinguish the insurance agent's need to obtain user information and the customer's need to obtain user information). At this time, the business party can further optimize the common module according to different business scenarios (corresponding to the native scenario interface).

[0079] The setting method of the above-mentioned native scenario interface and native call interface can be determined according to the native functions that need to be called for data requests during actual work. If the native functions that need to be called do not need to distinguish specific business scenarios, the native call interface is used uniformly. If the native functions that need to be called need to distinguish specific business scenarios, the appropriate native scenario interface is selected according to different business scenarios.

[0080] In this embodiment, the present application can also distinguish between the native call interface and the native scenario interface by setting common parameters and distinguishing parameters in the call data information (or interface parameters). For example, when it is necessary to obtain user identity information, the call data information obtained by the insurance agent is 21, and the call data information obtained by the customer is 22. In this way, the present application can allow both the insurance agent and the customer to obtain the same native name (that is, the native call interface) according to the call data information, and can further divide the native name into the native name corresponding to the agent (native scenario interface) and the native name corresponding to the customer (native scenario interface).

[0081] Among them, the first digit "2" (that is, the tens digit, which is a common parameter) in the above-mentioned call data information means that both the insurance agent and the customer need to obtain the user identity information, and the second digit "1" (that is, the ones digit, which is a distinguishing parameter, the same below) indicates that the initiator of the data request is the insurance agent, and the second digit "2" indicates that the initiator of the data request is the customer.

[0082] At the same time, different business scenarios in the present invention may have different requirements, so the business scenario only needs to be encapsulated in the module of the corresponding business scenario. For example, in the new architecture diagram, the AI ​​interview module and the follow-up module are native functions unique to each business scenario. For example, in the follow-up module, there are functions to open the follow-up recording page and the video playback page. These are native functions unique to follow-up. If a new app wants to access the follow-up function of this application, it only needs to access the follow-up module. Other modules do not need to be connected.

[0083] Preferably, the present invention also includes defining data communication standards to ensure the universality of data flow, for example, the request data formed by the data request may include module name, method name, and payload, and the payload includes parameters and callbacks. The request response packet generated for the above data request may include status code, status description, and data.

[0084] The cross-platform native function calling method based on the hybrid technology stack described in this embodiment is implemented based on a cross-platform communication framework, such as Figure 2 As shown, the above cross-platform communication framework is a communication framework designed by the inventor of the present application, including: a business layer 11, a component layer 12, a driver layer 13 and a native bottom layer 14.

[0085] Business layer 11, the main users call the services of the component layer according to the needs of communication services, including: a first business based on the Web front-end technology stack and a second business based on the React Native technology stack. The above-mentioned first business (also called Web business) and the second business (also called RN business) are mainly pages displayed on mobile terminals.

[0086] The first business (Web business) refers to the pages developed based on the Web front-end technology stack. The main technical advantage of the current Web business is that it is fast to deploy and can be quickly updated. Among them, the Web business may include monthly or holiday activity pages and some functional pages (such as AI cloud interview pages, claims map pages, and product card pages, etc.).

[0087] The second business (also called RN business) refers to the page developed based on the React Native technology stack, which also has the advantage of fast deployment, but the above-mentioned native business is more delicate in data interaction than the Web business. Among them, the second business mainly includes the AI ​​follow-up homepage, all pages of the personal ranking module, and the contact module homepage.

[0088] In actual work, the application layer is mainly used to display the pages of the hybrid front-end technology stack to facilitate people to expand the data information on the native functional components.

[0089] The component layer 12 is mainly used for pre-packaged unified interfaces defined according to native functions, including: public module interface, AI interview module interface and follow-up module interface, etc.

[0090] The common module interface (commonMofine) includes the account information interface, WeChat sharing interface and environment information interface. The account information interface is an interface specifically used to obtain user account information (getAccountinfo interface), the WeChat sharing interface is an interface specifically used to share WeChat links, and the environment information interface is an interface specifically used to obtain the environment information of the application app;

[0091] The AI ​​interview module interface includes the jump to interview conference room interface and the recording function interface, among which the switch to interview conference room interface is specifically used to allow users to jump to the appropriate interview conference room interface, and the recording function interface is specifically used to turn on the recording function;

[0092] The follow-up module interface includes an interface for opening the follow-up recording page and an interface for opening the video playback page, wherein the interface for opening the follow-up recording page is specifically used to open the follow-up recording page, and the interface for opening the video playback page is specifically used to open the video playback page.

[0093] Preferably, the component layer 12 is also used to encapsulate the application interface to obtain an encapsulated interface, which communicates with a third-party system through a unified outbound call module; the interface cannot be modified but can only be expanded; the present application can set a unified interface according to the actual needs of each APP, so that each APP can call the information on the native functional component according to its own needs.

[0094] Driver layer 13, the main user is responsible for the construction of JS end bridge (such as javascriptcore of IOS platform) and native end bridge (ie React Native Bridge) to build a unified communication channel, including: the first channel based on the Web front-end technology stack, and the second channel based on the React Native technology stack.

[0095] Among them, the first channel includes a Web requester, a Web responder and a Web kernel, and the second channel includes an RN requester, an RN responder and an RN kernel. Among them, WebBridge is based on the Web kernel, such as JavaScriptCore on the iOS side, and WebBridge is used to build requests and responses for Web communications. RNBridge is based on the ReactNative kernel (such as NativeModules, also known as the RN kernel), and RNBridge is used to build requests and responses for RN communications. The above-mentioned WebBridge and RNBridge uniformly manage event requests and callbacks.

[0096] In this embodiment, a unified driver entry (nativeCall) and a unified driver exit (NativeCallManager) are also provided on the service driver channel in the driver layer. The input end of the first channel and the second channel are both connected to the unified driver entry (nativeCall), and the output end of the first channel and the output end of the second channel are both connected to the unified driver exit (NativeCallManager).

[0097] The native bottom layer 14 is responsible for the maintenance and implementation of native modules and methods (that is, the data requests generated by the user operation page). There are many native functions in this application, including: the bottom layer implementation of the public module (including obtaining account information, sharing WeChat, and obtaining environmental information, etc.), the bottom layer implementation of the AI ​​interview module (including jumping to the interview meeting room, turning on the recording function, etc.), and the bottom layer implementation of the follow-up module (opening the follow-up recording page, opening the video playback page).

[0098] The subsequent maintenance and new features of the above-mentioned cross-platform communication framework of this application do not need to implement a set of services for the Web front-end technology stack and the ReactNative technology stack respectively. It only needs to be maintained at the native bottom layer and component layer and provide a set of services, which improves development efficiency and reduces development costs.

[0099] This application proposes a unified and data-secure native communication method under multiple hybrid technology stacks and multiple access methods. The technology stack and the native access method are hidden in the driver layer, and the driver layer is distributed to different modules and methods according to different module names and method names, so as to achieve one set of interfaces and multiple sets of implementations.

[0100] Finally, the component layer accesses the unified port (unified driver entry and unified driver exit) on the driver layer according to the protocol format, achieving consistent implementation of the driver layer and native functions. At the same time, in order to ensure data security, the data is uniformly transmitted in the form of JSON strings to avoid problems caused by data type conversion between different technology stacks. In addition, the component layer is implemented consistently even when the technology stack is different, so that the implementation of accessing native functions can be updated during iteration without affecting the application layer.

[0101] Figure 3 FIG. 1 is a schematic diagram of a cross-platform native function calling device based on a hybrid technology stack according to a second embodiment of the present invention. Figure 3 As shown, the cross-platform native function calling device based on the hybrid technology stack includes:

[0102] The page acquisition module 21 is used to acquire a user operation page preset in the business layer according to the user's operation instruction, wherein the user operation page is one of the multiple first pages based on the Web front-end technology stack, or one of the multiple second pages based on the ReactNative technology stack;

[0103] The data request acquisition module 22 is used to acquire the data request generated by the user operation page, wherein the data request includes interface parameters and call data information;

[0104] The encapsulated interface acquisition module 23 is used to acquire the encapsulated navigation interface preset in the component layer according to the interface parameters, and there are multiple encapsulated navigation interfaces;

[0105] A driving channel acquisition module 24 is used to acquire a business driving channel preset in the driving layer according to the encapsulated navigation interface, wherein the business driving channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer, and the business driving channel includes a first channel based on the Web front-end technology stack and a second channel based on the React Native technology stack;

[0106] A native name acquisition module 25, used for acquiring a native name preset in the driver layer according to the call data information, wherein the native name is a registered name corresponding to a native function capable of realizing the data request;

[0107] The native function acquisition module 26 is used to call the native function preset in the native bottom layer according to the native name.

[0108] For the specific limitations of the cross-platform native function calling device based on the hybrid technology stack, please refer to the limitations of the cross-platform native function calling method based on the hybrid technology stack above, which will not be repeated here. Each module in the above-mentioned cross-platform native function calling device based on the hybrid technology stack can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0109] Figure 4 Schematic diagram of the structure of the electronic device according to the third embodiment of the present invention. Figure 4 As shown, the electronic device 30 includes a processor 31 and a memory 32 coupled to the processor 31 .

[0110] The memory 32 stores program instructions for implementing the cross-platform native function calling method based on the hybrid technology stack of any of the above embodiments.

[0111] The processor 31 is used to execute program instructions stored in the memory 32 to process the pollution monitoring data.

[0112] The processor 31 may also be referred to as a CPU (Central Processing Unit). The processor 31 may be an integrated circuit chip having signal processing capabilities. The processor 31 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0113] See also Figure 5 , Figure 5Schematic diagram of the structure of the storage medium of the fourth embodiment of the present invention. The storage medium 40 of the fourth embodiment of the present invention stores program instructions 41 that can implement all the above methods, wherein the program instructions 41 can be stored in the above storage medium in the form of a software product, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or terminal devices such as a computer, a server, a mobile phone, and a tablet.

[0114] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0115] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units. The above is only an implementation mode of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present invention.

[0116] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile and / or volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0117] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the present invention only takes the division of the above-mentioned functional units and modules as examples. In actual applications, the above-mentioned functions can be distributed to different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.

Claims

1. A cross-platform native function calling method based on a hybrid technology stack, characterized in that: include: Acquire a user operation page preset in the business layer according to the user's operation instruction, wherein the user operation page is one of a plurality of first pages based on the Web front-end technology stack, or one of a plurality of second pages based on the React Native technology stack; Acquire a data request generated by the user operating the page, wherein the data request includes interface parameters and call data information; Acquire a packaged navigation interface preset in the component layer according to the interface parameter, wherein there are multiple packaged navigation interfaces; Acquire a business driving channel preset in the driver layer according to the encapsulated navigation interface, wherein the business driving channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer, and the business driving channel includes a first channel based on the Web front-end technology stack and a second channel based on the React Native technology stack; The acquiring of the service driving channel preset in the driving layer according to the encapsulated navigation interface includes: Acquire a unified driver entry preset in the driver layer according to the encapsulated navigation interface, the unified driver entry being a method call entry for each of the encapsulated navigation interfaces; Parsing the data request through the unified driver entry to obtain a first parsing result; Acquire a bridge protocol that can respond to the data request according to the first parsing result, and acquire a business-driven channel according to the bridge protocol, wherein the bridge protocol includes a first protocol based on a Web front-end technology stack and a second protocol based on a React Native technology stack; The acquiring of the service driving channel according to the bridge protocol includes: Determine whether the bridge protocol corresponds to the first channel, if so, use the first channel as a service driving channel to respond to the data request; if not, use the second channel as a service driving channel to respond to the data request; Acquire a native name preset in the driver layer according to the call data information, where the native name is a registered name corresponding to a native function capable of implementing the data request; The native function preset in the native bottom layer is called according to the native name.

2. The method according to claim 1, characterized in that The acquiring of the native name preset in the driver layer according to the calling data information includes: Get the unified driver export preset in the driver layer; Determining, according to the call data information, a native function that can realize the data request; Acquire a native name preset in the driver layer according to the native function.

3. The method according to claim 2, characterized in that The acquiring of the native name preset in the driver layer according to the calling data information also includes: Determine whether there is a native function corresponding to the native name in the native bottom layer; If so, the native function is called; if not, the cross-platform native function calling method based on the hybrid technology stack is terminated.

4. The method according to claim 3, characterized in that The native function includes a plurality of native scenario functions set according to different business scenarios, and after calling the native function preset in the native bottom layer according to the native name, it also includes: Acquire a native call interface preset in the native bottom layer and corresponding to the native function according to the native name, wherein there are multiple native call interfaces, and each native call interface includes multiple native scenario interfaces set according to different business scenarios and corresponding to the native scenario function; Obtain user identity information, and obtain a native scene interface according to the user identity information and the native name; Obtain the corresponding native scene function according to the native scene interface.

5. The method according to claim 4, characterized in that After calling the native function preset in the native bottom layer according to the native name, the method further includes: The execution result of the native function is obtained, and the execution result is returned to the business-driven channel, the encapsulated navigation interface and the user operation page in sequence according to the bridge protocol.

6. A cross-platform native function calling device based on a hybrid technology stack, the device being used to implement a cross-platform native function calling method based on a hybrid technology stack as claimed in any one of claims 1 to 5, characterized in that: include: A page acquisition module, used to acquire a user operation page preset in the business layer, wherein the user operation page includes a plurality of first pages based on the Web front-end technology stack and a plurality of second pages based on the React Native technology stack; An encapsulated interface acquisition module, used to acquire an encapsulated navigation interface preset in the component layer according to a data request generated by the user operating the page, wherein there are multiple encapsulated navigation interfaces; A driving channel acquisition module is used to acquire a business driving channel preset in the driving layer according to the data request, wherein the business driving channel is a communication channel from the encapsulated navigation interface to the preset native bottom layer, and the business driving channel includes a first channel based on the Web front-end technology stack and a second channel based on the React Native technology stack; A native name acquisition module, used to acquire a native name preset in the driver layer according to the data request, wherein the native name is a registered name corresponding to a native function capable of realizing the data request; The native function acquisition module is used to call the native function preset in the native bottom layer according to the native name.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the cross-platform native function calling method based on a hybrid technology stack as described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the cross-platform native function calling method based on a hybrid technology stack as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method for data interaction between JavaScript and native APP

    CN109976831A

  • Interface request method, device and equipment and computer readable storage medium

    CN111538889A