Android modular base-based native application integration method, device and equipment
By introducing modular base and messaging modules in Android native applications, the high coupling problem when Android native applications integrate multiple front-end subsystems is solved, more efficient development and maintenance is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202411686395.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-25
AI Technical Summary
When Android native applications integrate multiple front-end subsystems, the program coupling is high, resulting in complex code maintenance and upgrades, increasing development and maintenance costs, and limiting parallel development efficiency.
Using a native application integration method based on Android modular base, the BaseWebView, BaseInterface and BaseEventBus components are encapsulated to realize the unified display and interaction of each front-end subsystem in Android native applications, reduce the amount of duplicate code, and realize communication between interfaces through the message delivery module.
It reduces program coupling, simplifies code maintenance and upgrades, improves parallel development efficiency, reduces development time and cost, and improves user stickiness.
Smart Images

Figure CN119536795A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to a native application integration method, device, equipment and medium based on an Android modular base. Background Art
[0002] In mobile application development, it is a common requirement to integrate multiple front-end subsystems into Android native applications. The integration methods in related technologies mainly rely on Android native development components WebView and JsBridge. However:
[0003] When using WebView and JsBridge to integrate multiple front-end subsystems, the interaction between each subsystem and the Android native application will increase the coupling of the program, making code maintenance and upgrades more complicated, increasing the cost of development and maintenance;
[0004] Due to the high degree of coupling, the development of different subsystems often needs to wait for the partial completion of other subsystems or native applications, which limits the efficiency of parallel development and prolongs the development cycle;
[0005] At the same time, with the rapid iteration and update of functional requirements, applications (APPs) need to frequently iterate and upgrade versions, which increases the development workload and leads to a decrease in user stickiness. Summary of the invention
[0006] The present invention provides a native application integration method, device, equipment and medium based on an Android modular base, which solves the problems of high program coupling and limited development efficiency when Android native applications integrate multiple front-end subsystems.
[0007] In order to achieve the above objectives, this application adopts the following technical solutions:
[0008] In a first aspect, a native application integration method based on an Android modular base is provided, comprising:
[0009] The front-end subsystem calls the native code scanning function through the pre-configured Android base; wherein the Android base includes an Android modular base, and the Android modular base includes a BaseWebView component, a BaseEventBus component, and a BaseInterface component; the BaseWebView component is an entity class formed by extracting and encapsulating a third-party web page display control, and is used for front-end interface display; the BaseEventBus component is an entity class formed by introducing a third-party dependency, and is used for message transmission between modules of the Android modular base; the BaseInterface component is a control that defines a unified interaction method between Android native applications and front-end subsystems;
[0010] Define the code scanning function method in the BaseInterface component;
[0011] Define a method for receiving scan results in the front-end subsystem;
[0012] In the code scanning function method, the message of the front-end subsystem calling the code scanning function module is transmitted to the code scanning function module through the BaseEventBus component;
[0013] After receiving the message, the code scanning function module calls the code scanning function to scan the code. After the code scanning is successful, the code scanning result is returned to the front-end subsystem through the BaseWebView component;
[0014] After the front-end subsystem receives the scan result, it proceeds to the next step.
[0015] In a first possible implementation manner of the first aspect, the Android basic base further includes:
[0016] APP application layer, the APP application layer includes APP common function modules and multiple front-end subsystems;
[0017] Android Framework layer, which includes UI templates, mobile development framework, development tool set and database services;
[0018] Android mobile phone hardware module, the Android mobile phone hardware module includes at least one mobile phone hardware.
[0019] In a second possible implementation manner of the first aspect, building the BaseWebView component includes the following steps:
[0020] Introduce the third-party web page display control agentWeb into the project;
[0021] Create a new BaseWebView class;
[0022] Create a new function parameter method and interface loading method in the BaseWebView class;
[0023] Among them, the function parameter method is responsible for the function parameter configuration of the front-end interface, performs function configuration for WebSettings, and is uniformly called by the interface loading method; the interface loading method encapsulates the interface loading method of the agentWeb, wherein the method parameters include Activity, LinearLayout, and String, and the three parameters correspond to the Activity context, the LinearLayout front-end display container, and the front-end link, respectively.
[0024] Based on the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, building the BaseEventBus component includes the following steps:
[0025] Introducing third-party dependencies into said project;
[0026] Create a new entity class BaseEventCustom, which includes a message tag and message content;
[0027] When the BaseInterface component receives a call request from the subsystem front-end interface, it passes the message body to the demand realization module; the demand realization module receives the message from the BaseInterface to realize the specific demand, and after realizing the specific demand, it passes the message to the front-end subsystem.
[0028] Based on the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, building the BaseInterface component includes the following steps:
[0029] Create a new BaseInterface class in the project;
[0030] In the BaseInterface class, define unified call tags, agentWeb and Context, and define a construction method at the same time, and the construction method parameters are agentWeb and Context. The construction method will be called in the interface loading method of the BaseWebView component;
[0031] After receiving the demand call from the subsystem front-end interface, the BaseInterface component uses the entity class BaseEventCustom to distribute the demand message to the specific implementation module.
[0032] In a second aspect, a native application integration device based on an Android modular base is provided, comprising:
[0033] The native code scanning function calling module is used for the front-end subsystem to call the native code scanning function through the pre-configured Android basic base; wherein, the Android basic base includes an Android modular base, and the Android modular base includes a BaseWebView component, a BaseEventBus component, and a BaseInterface component; the BaseWebView component is an entity class formed by extracting and encapsulating a third-party web page display control, and is used for front-end interface display; the BaseEventBus component is an entity class formed by introducing a third-party dependency, and is used for message transmission between modules of the Android modular base; the BaseInterface component is a control that defines a unified interaction method between Android native applications and front-end subsystems;
[0034] The code scanning function method definition module is used to define the code scanning function method in the BaseInterface component;
[0035] A code scanning result receiving method definition module, used to define a code scanning result receiving method in the front-end subsystem;
[0036] A message passing module, used for passing the message of the front-end subsystem calling the code scanning function module to the code scanning function module through the BaseEventBus component in the code scanning function method;
[0037] The code scanning result feedback module is used to call the code scanning function to scan the code after the code scanning function module receives the message. After the code scanning is successful, the code scanning result is sent back to the front-end subsystem through the BaseWebView component;
[0038] The code scanning result receiving module is used for the front-end subsystem to perform the next operation after receiving the code scanning result.
[0039] In a first possible implementation manner of the second aspect, the Android basic base further includes:
[0040] APP application layer, the APP application layer includes APP common function modules and multiple front-end subsystems;
[0041] Android Framework layer, which includes UI templates, mobile development framework, development tool set and database services;
[0042] Android mobile phone hardware module, the Android mobile phone hardware module includes at least one mobile phone hardware.
[0043] In a second possible implementation manner of the second aspect, building the BaseWebView component includes the following steps:
[0044] Introduce the third-party web page display control agentWeb into the project;
[0045] Create a new BaseWebView class;
[0046] Create a new function parameter method and interface loading method in the BaseWebView class;
[0047] The function parameter method is responsible for configuring the function parameters of the front-end interface, and performs function configuration for WebSettings, which is uniformly called by the interface loading method; the interface loading method encapsulates the interface loading method of the agentWeb, wherein the method parameters include Activity, LinearLayout, and String, and the three parameters correspond to Activity context, LinearLayout front-end display container, and front-end link respectively;
[0048] Building the BaseEventBus component includes the following steps:
[0049] Introducing third-party dependencies into said project;
[0050] Create a new entity class BaseEventCustom, which includes a message tag and message content;
[0051] When the BaseInterface component receives a call request from the subsystem front-end interface, it passes the message body to the demand realization module; the demand realization module receives the message from the BaseInterface to realize the specific demand, and after realizing the specific demand, it passes the message to the front-end subsystem;
[0052] Building the BaseInterface component includes the following steps:
[0053] Create a new BaseInterface class in the project;
[0054] In the BaseInterface class, define unified call tags, agentWeb and Context, and define a construction method at the same time, and the construction method parameters are agentWeb and Context. The construction method will be called in the interface loading method of the BaseWebView component;
[0055] After receiving the demand call from the subsystem front-end interface, the BaseInterface component uses the entity class BaseEventCustom to distribute the demand message to the specific implementation module.
[0056] In a third aspect, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the native application integration method based on the Android modular base as described in the first aspect.
[0057] In a fourth aspect, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the native application integration method based on the Android modular base as described in the first aspect are implemented.
[0058] Beneficial effects:
[0059] This application transforms and encapsulates Android native into BaseWebView, BaseInterface, and BaseEventBus. BaseWebView encapsulates the WebView control that comes with the existing Android system, unifies the interface display and calling method, simplifies the calling process, and thus realizes the unified display of each front-end subsystem in the Android native application; after BaseInterface encapsulates the BaseWebView control to realize the display of each system in the Android native application, the interactive calls between each system and the Android native can realize the message communication between each interface through the encapsulated BaseEventBus, build a BaseEventBus message transmission module, and realize the message communication between the interfaces between the Android native application and each subsystem.
[0060] This solution can standardize the development framework, encapsulate unified service modules, design a unified interface style, formulate the notification process for mutual adjustment between Android native applications and subsystems, realize the parallel development of Android native applications and subsystems, and achieve the purpose and effect of reducing development time and program coupling. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1A schematic flow chart of a native application integration method based on an Android modular base provided in an embodiment of the present application;
[0062] Figure 2 A schematic flow chart of another native application integration method based on an Android modular base provided in an embodiment of the present application;
[0063] Figure 3 An Android base architecture diagram provided for an embodiment of the present application;
[0064] Figure 4 A structural block diagram of a native application integration device based on an Android modular base provided in an embodiment of the present application;
[0065] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined purpose, the technical solutions in the embodiments of the present application are clearly described. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present application.
[0067] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0068] The description of the method flow in the specification of the present application and the steps of the flowchart in the drawings of the present specification do not have to be strictly executed according to the step numbers, and the method steps can be executed in a different order. Moreover, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0069] The following is a detailed description of the native application integration method, device, equipment and medium based on the Android modular base provided in the embodiments of the present application in combination with the accompanying drawings and preferred embodiments.
[0070] First, the application scenario of the native application integration method based on the Android modular base in the embodiment of the present application is described in detail.
[0071] In the related technology, most of the Android native applications that integrate multiple front-end subsystems start from the Android native development components WebView and JsBridge, considering the influencing factors of multiple dimensions such as development time, labor cost and program coupling. This method will result in high program coupling and low parallel development efficiency. At the same time, the rapid iterative update of functional requirements greatly increases the number of APP version iterations and upgrades, thereby reducing user stickiness.
[0072] In response to the above technical problems, this application proposes a native application integration method based on the Android modular base, which aims to reduce program coupling and improve parallel development efficiency, analyze existing needs, and use the original WebView component of traditional Android native development for improvement, thereby solving the problems of high program coupling and low parallel development efficiency; by upgrading the function of the Android native WebView display component and encapsulating it into a BaseWebView front-end subsystem display control, the interface display of each subsystem in the Android native application is realized; by encapsulating a unified Android native application and front-end subsystem interaction module BaseInterface, the unified call of Android native application and each subsystem method is realized, thereby reducing the amount of repeated code; building a BaseEventBus message transmission module to realize the message communication of the interface between Android native applications and each subsystem.
[0073] This solution uses a unified Android application interface style, component services, development framework, and development specifications to package into a unified APK installation package for release, achieving unified management of Android native applications and subsystems. The entire system uses one software to achieve parallel development of Android native applications and subsystems, thereby reducing development time and program coupling, and meeting usage requirements in different user application scenarios.
[0074] See also Figure 1-2 , the embodiment of the present application provides a native application integration method based on Android modular base, such as Figure 1-2 As shown, the integration method of the embodiment of the present application includes the following steps:
[0075] Step S1, the front-end subsystem calls the native code scanning function through the pre-configured Android base.
[0076] Wherein, the Android basic base includes an Android modular base, and the Android modular base includes a BaseWebView component, a BaseEventBus component, and a BaseInterface component;
[0077] The BaseWebView component is an entity class formed by extracting and encapsulating third-party web page display controls, and is used for front-end interface display. Specifically: it is the core control of the subsystem displayed in Android native applications. The third-party web page display control agentWeb is introduced through Android's own dependency management tool Gradle, and the core methods of agentWeb are extracted and encapsulated to form the BaseWebView class. By encapsulating agentWeb, the call of agentWeb is simplified, unified configuration and management are provided, and some common functions are implemented, such as interaction with JavaScript, network request processing, page loading status management, etc., and the subsystem can be integrated into Android native applications.
[0078] The BaseEventBus component is an entity class formed by introducing third-party dependencies, and is used for message transmission between modules of the Android modular base. Specifically: after the BaseInterface message hub component introduces the call method from the front-end interface, this component can distribute the method requirements to the specific requirement implementation module. BaseEventBus is a publish-subscribe event bus with three major elements: Event: event, Publisher: publisher, which can publish events in any thread, and Subscrible: subscriber. Based on the observer pattern, it separates the receiver and sender of the event, simplifying the communication between components.
[0079] The BaseInterface component is a control that defines a unified interaction method between Android native applications and front-end subsystems. Specifically: This component is a core hub control that encapsulates a unified interaction method between Android native applications and subsystems. By defining the interaction method in this component, the Android native application and the subsystem interaction method can be called each other. Through this interactive hub control, Android native applications and each subsystem's front-end applications unify the mutual calling process, calling rules, and calling methods. The same function interactive call can use one method, which can effectively reduce duplicate code.
[0080] For example, see Figure 3:The above-mentioned Android basic base includes the APP application layer, the Android modular base, the Android Framework layer and the Android mobile phone hardware module. The APP application layer includes the APP public function module and multiple front-end subsystems, and usually integrates the login function. The Android modular base includes the BaseWebView component, the BaseInterface component and the BaseEventBus component. The Android Framework layer includes UI templates, mobile development frameworks, development tool sets and database services. The Android mobile phone hardware module can include mobile phone hardware such as cameras, GPS / Beidou, sensors, Bluetooth / WiFi, and audio and video data playback.
[0081] In some possible implementations, building a BaseWebView component includes the following steps:
[0082] Step S111, introducing a third-party web page display control agentWeb into the project.
[0083] Step S112, creating a new BaseWebView class.
[0084] Step S113, creating a function parameter method and an interface loading method in the BaseWebView class;
[0085] Among them, the function parameter method is responsible for the function parameter configuration of the front-end interface, performs function configuration for WebSettings, and is uniformly called by the interface loading method; the interface loading method encapsulates the interface loading method of agentWeb, and the method parameters include Activity, LinearLayout, and String. The three parameters correspond to the Activity context, LinearLayout front-end display container, and front-end link respectively.
[0086] In the specific implementation, in the interface loading method, first get a JavaScript interface holder from the agentWeb object; then create an instance of BaseInterface and pass the necessary parameters agentWeb and activity; use the addJavaObject method of the interface holder to add the instance of BaseInterface to the holder, where BaseInterface.className is used as the key (or identifier) and baseInterfaceInstance is used as the value (or actual object). The exemplary code is as follows:
[0087] agentWeb.getJsInterfaceHolder().addJavaObject(BaseInterface.className,new BaseInterface(agentWeb,activity))
[0088] The Activity responsible for displaying the interface calls the BaseInterface method. In addition, the function parameter method needs to be called in the interface loading method to display the display attributes of the front-end interface.
[0089] In the Activity, call the createWebView method of the BaseWebView instance and pass the necessary parameters: the context of the current Activity, the LinearLayout for placing the WebView, and the URL of the web page to be loaded; the createWebView method returns an AgentWeb instance that has been configured and associated with the LinearLayout, loads the specified web page and displays it in the Activity. The sample code is as follows:
[0090] AgentWeb agentWeb=newBaseWebView().createWebView(this,llWeb,mWebUrl).
[0091] That is to say, the above function parameter method mainly binds the front-end subsystem and the method provided by the Android base to the front-end subsystem, so as to achieve the purpose of the front-end subsystem calling the Android base method; the above interface loading method mainly causes the Android base to call the front-end subsystem address, so as to achieve the purpose of the Android base loading the front-end interface. The two methods can be used together to achieve the effect of displaying the front-end subsystem on the Android base, and the front-end subsystem and the Android base calling each other's methods.
[0092] In some possible implementations, building a BaseEventBus component includes the following steps:
[0093] Step S121, introduce a third-party dependency (org.simple:androideventbus) into the project. This dependency is responsible for implementing message communication between internal modules.
[0094] Step S122, create a new entity class BaseEventCustom, which includes message tags and message content. For example, the entity class includes variables such as tag, content1, content2, and content3, where tag is responsible for transmitting tags, responsible for sending messages and accurate reception of messages at the receiving end, and the remaining variables are responsible for transmitting message content.
[0095] When the BaseInterface component receives a call request from the subsystem front-end interface, it passes the message body to the demand implementation module. In specific implementation, first find the default instance of EventBus and send a baseEventCustom event object that encapsulates specific information. Then, call the post method and pass the baseEventCustom object as a parameter to it to send the message. The exemplary code is as follows: EventBus.getDefault().post(baseEventCustom).
[0096] The demand realization module receives messages from BaseInterface to realize specific requirements, and passes the messages to the front-end subsystem after realizing the specific requirements. In the specific implementation, first register EventBus to receive messages in the demand realization module, and register the current instance as a subscriber of EventBus; then define a method that will be called by EventBus when receiving a matching event to process the received message; process the specific requirements according to the event tag and other content, and process the received message (BaseEventCustom event); finally, use AgentWeb to pass the processing results to the front-end subsystem. The exemplary code is as follows:
[0097] EventBus.getDefault().register(this)
[0098] AgentWeb.getJsEntraceAccess().quickCallJs(front-end method body, message).
[0099] In some possible implementations, constructing a BaseInterface component includes the following steps:
[0100] Step S131, create a new BaseInterface class in the project.
[0101] Step S132, define a unified call tag, agentWeb (front-end display control) and Context (context) in the BaseInterface class, and define a construction method at the same time, and the construction method parameters are agentWeb and Context. This method will be called in the interface loading method of the BaseWebView component.
[0102] After the BaseInterface component receives the demand call from the subsystem front-end interface, it uses the entity class BaseEventCustom to distribute the demand message to the specific implementation module.
[0103] Step S2: define a code scanning function method in the BaseInterface component of the Android modular base, for example, define the code scanning function method as scanForH5().
[0104] Step S3: define a method for receiving the scan result in the front-end subsystem. For example, define the method for receiving the scan result as postScanResult(String result).
[0105] Step S4: In the code scanning function method, the message of the front-end subsystem calling the code scanning function module is passed to the code scanning function module through the BaseEventBus component.
[0106] BaseEventCustom can be used to pass the message from the front-end subsystem calling the code scanning function module to the code scanning function module.
[0107] Step S5, after receiving the message, the code scanning function module calls the code scanning function to scan the code. After the code scanning is successful, the scanning result is returned to the front-end subsystem through the BaseWebView component.
[0108] After the code is scanned successfully, the scan result is sent back to the front-end subsystem through AgentWeb. In the specific implementation, first obtain a permission for accessing the JavaScript interface from the AgentWeb object; define a function to quickly call the JavaScript method, which accepts three parameters: interface access permission, JavaScript method name, and parameters passed to the method; use this function to call the JavaScript method named postScanResult through the interface access permission and pass the variable result as a parameter. The exemplary code is as follows: AgentWeb.getJsEntraceAccess().quickCallJs("postScanResult",result).
[0109] Step S6: After the front-end subsystem receives the scan result, it proceeds to the next step.
[0110] Based on the above integration method, this application has the following technical effects:
[0111] This application transforms and encapsulates Android native into BaseWebView, BaseInterface, and BaseEventBus. BaseWebView encapsulates the WebView control that comes with the existing Android system, unifies the interface display and calling method, simplifies the calling process, and thus realizes the unified display of each front-end subsystem in the Android native application; after BaseInterface encapsulates the BaseWebView control to realize the display of each system in the Android native application, the interactive calls between each system and the Android native can realize the message communication between each interface through the encapsulated BaseEventBus, build a BaseEventBus message transmission module, and realize the message communication between the interfaces between the Android native application and each subsystem.
[0112] This solution can standardize the development framework, encapsulate unified service modules, design a unified interface style, formulate the notification process for mutual adjustment between Android native applications and subsystems, realize the parallel development of Android native applications and subsystems, and achieve the purpose and effect of reducing development time and program coupling.
[0113] See also Figure 4 , corresponding to the above-mentioned embodiment of the native application integration method based on the Android modular base, the embodiment of the present application provides a native application integration device based on the Android modular base, and the integration device includes:
[0114] The native code scanning function calling module 1001 is used for the front-end subsystem to call the native code scanning function through the pre-configured Android basic base; wherein the Android basic base includes an Android modular base, and the Android modular base includes a BaseWebView component, a BaseEventBus component, and a BaseInterface component; the BaseWebView component is an entity class formed by extracting and encapsulating a third-party web page display control, and is used for front-end interface display; the BaseEventBus component is an entity class formed by introducing a third-party dependency, and is used for message transmission between modules of the Android modular base; the BaseInterface component is a control that defines a unified interaction method between Android native applications and front-end subsystems;
[0115] A code scanning function method definition module 1002 is used to define a code scanning function method in the BaseInterface component;
[0116] A code scanning result receiving method definition module 1003, used to define a code scanning result receiving method in the front-end subsystem;
[0117] A message transfer module 1004 is used to transfer the message of the front-end subsystem calling the code scanning function module to the code scanning function module through the BaseEventBus component in the code scanning function method;
[0118] The code scanning result feedback module 1005 is used for the code scanning function module to call the code scanning function to scan the code after receiving the message, and after the code scanning is successful, the code scanning result is sent back to the front-end subsystem through the BaseWebView component;
[0119] The code scanning result receiving module 1006 is used for the front-end subsystem to perform the next operation after receiving the code scanning result.
[0120] Furthermore, the Android basic base also includes:
[0121] APP application layer, the APP application layer includes APP common function modules and multiple front-end subsystems;
[0122] Android Framework layer, which includes UI templates, mobile development framework, development tool set and database services;
[0123] Android mobile phone hardware module, the Android mobile phone hardware module includes at least one mobile phone hardware.
[0124] Furthermore, constructing the BaseWebView component includes the following steps:
[0125] Introduce the third-party web page display control agentWeb into the project;
[0126] Create a new BaseWebView class;
[0127] Create a new function parameter method and interface loading method in the BaseWebView class;
[0128] The function parameter method is responsible for configuring the function parameters of the front-end interface, and performs function configuration for WebSettings, which is uniformly called by the interface loading method; the interface loading method encapsulates the interface loading method of the agentWeb, wherein the method parameters include Activity, LinearLayout, and String, and the three parameters correspond to Activity context, LinearLayout front-end display container, and front-end link respectively;
[0129] Building the BaseEventBus component includes the following steps:
[0130] Introducing third-party dependencies into said project;
[0131] Create a new entity class BaseEventCustom, which includes a message tag and message content;
[0132] When the BaseInterface component receives a call request from the subsystem front-end interface, it passes the message body to the demand realization module; the demand realization module receives the message from the BaseInterface to realize the specific demand, and after realizing the specific demand, it passes the message to the front-end subsystem;
[0133] Building the BaseInterface component includes the following steps:
[0134] Create a new BaseInterface class in the project;
[0135] In the BaseInterface class, define unified call tags, agentWeb and Context, and define a construction method at the same time, and the construction method parameters are agentWeb and Context. The construction method will be called in the interface loading method of the BaseWebView component;
[0136] After receiving the demand call from the subsystem front-end interface, the BaseInterface component uses the entity class BaseEventCustom to distribute the demand message to the specific implementation module.
[0137] The above-mentioned native application integration device based on Android modular base implements the steps and various processes of the above-mentioned native application integration method embodiment based on Android modular base, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0138] See also Figure 5, corresponding to the above-mentioned embodiment of the native application integration method based on the Android modular base, an embodiment of the present application provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the above-mentioned embodiment of the native application integration method based on the Android modular base and the various processes of the embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0139] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0140] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1010.
[0141] Corresponding to the above-mentioned embodiment of the native application integration method based on the Android modular base, the embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by the processor, the steps of the above-mentioned embodiment of the native application integration method based on the Android modular base and the various processes of the embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0142] The processor is the processor in the electronic device described in the above embodiment of the present application. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0143] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0145] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A native application integration method based on Android modular base, characterized in that: include: The front-end subsystem calls the native code scanning function through the pre-configured Android base; wherein the Android base includes an Android modular base, and the Android modular base includes a BaseWebView component, a BaseEventBus component, and a BaseInterface component; the BaseWebView component is an entity class formed by extracting and encapsulating a third-party web page display control, and is used for front-end interface display; the BaseEventBus component is an entity class formed by introducing a third-party dependency, and is used for message transmission between modules of the Android modular base; the BaseInterface component is a control that defines a unified interaction method between Android native applications and front-end subsystems; Define the code scanning function method in the BaseInterface component; Define a method for receiving scan results in the front-end subsystem; In the code scanning function method, the message of the front-end subsystem calling the code scanning function module is transmitted to the code scanning function module through the BaseEventBus component; After receiving the message, the code scanning function module calls the code scanning function to scan the code. After the code scanning is successful, the code scanning result is returned to the front-end subsystem through the BaseWebView component; After the front-end subsystem receives the scan result, it proceeds to the next step.
2. The native application integration method based on Android modular base according to claim 1, characterized in that: The Android basic base also includes: APP application layer, the APP application layer includes APP common function modules and multiple front-end subsystems; Android Framework layer, which includes UI templates, mobile development framework, development tool set and database services; Android mobile phone hardware module, the Android mobile phone hardware module includes at least one mobile phone hardware.
3. The native application integration method based on Android modular base according to claim 1, characterized in that: Building the BaseWebView component includes the following steps: Introduce the third-party web page display control agentWeb into the project; Create a new BaseWebView class; Create a new function parameter method and interface loading method in the BaseWebView class; Among them, the function parameter method is responsible for the function parameter configuration of the front-end interface, performs function configuration for WebSettings, and is uniformly called by the interface loading method; the interface loading method encapsulates the interface loading method of the agentWeb, wherein the method parameters include Activity, LinearLayout, and String, and the three parameters correspond to the Activity context, the LinearLayout front-end display container, and the front-end link, respectively.
4. The native application integration method based on Android modular base according to claim 3 is characterized in that: Building the BaseEventBus component includes the following steps: Introducing third-party dependencies into said project; Create a new entity class BaseEventCustom, which includes a message tag and message content; When the BaseInterface component receives a call request from the subsystem front-end interface, it passes the message body to the demand realization module; the demand realization module receives the message from the BaseInterface to realize the specific demand, and after realizing the specific demand, it passes the message to the front-end subsystem.
5. The native application integration method based on Android modular base according to claim 4 is characterized in that: Building the BaseInterface component includes the following steps: Create a new BaseInterface class in the project; In the BaseInterface class, define unified call tags, agentWeb and Context, and define a construction method at the same time, and the construction method parameters are agentWeb and Context. The construction method will be called in the interface loading method of the BaseWebView component; After receiving the demand call from the subsystem front-end interface, the BaseInterface component uses the entity class BaseEventCustom to distribute the demand message to the specific implementation module.
6. A native application integration device based on an Android modular base, characterized in that: include: The native code scanning function calling module is used for the front-end subsystem to call the native code scanning function through the pre-configured Android basic base; wherein, the Android basic base includes an Android modular base, and the Android modular base includes a BaseWebView component, a BaseEventBus component, and a BaseInterface component; the BaseWebView component is an entity class formed by extracting and encapsulating a third-party web page display control, and is used for front-end interface display; the BaseEventBus component is an entity class formed by introducing a third-party dependency, and is used for message transmission between modules of the Android modular base; the BaseInterface component is a control that defines a unified interaction method between Android native applications and front-end subsystems; The code scanning function method definition module is used to define the code scanning function method in the BaseInterface component; A code scanning result receiving method definition module, used to define a code scanning result receiving method in the front-end subsystem; A message passing module, used for passing the message of the front-end subsystem calling the code scanning function module to the code scanning function module through the BaseEventBus component in the code scanning function method; The code scanning result feedback module is used to call the code scanning function to scan the code after the code scanning function module receives the message. After the code scanning is successful, the code scanning result is sent back to the front-end subsystem through the BaseWebView component; The code scanning result receiving module is used for the front-end subsystem to perform the next operation after receiving the code scanning result.
7. The native application integration device based on Android modular base according to claim 6, characterized in that: The Android basic base also includes: APP application layer, the APP application layer includes APP common function modules and multiple front-end subsystems; Android Framework layer, which includes UI templates, mobile development framework, development tool set and database services; Android mobile phone hardware module, the Android mobile phone hardware module includes at least one mobile phone hardware.
8. The native application integration device based on Android modular base according to claim 6, characterized in that: Building the BaseWebView component includes the following steps: Introduce the third-party web page display control agentWeb into the project; Create a new BaseWebView class; Create a new function parameter method and interface loading method in the BaseWebView class; The function parameter method is responsible for configuring the function parameters of the front-end interface, and performs function configuration for WebSettings, which is uniformly called by the interface loading method; the interface loading method encapsulates the interface loading method of the agentWeb, wherein the method parameters include Activity, LinearLayout, and String, and the three parameters correspond to Activity context, LinearLayout front-end display container, and front-end link respectively; Building the BaseEventBus component includes the following steps: Introducing third-party dependencies into said project; Create a new entity class BaseEventCustom, which includes a message tag and message content; When the BaseInterface component receives a call request from the subsystem front-end interface, it passes the message body to the demand realization module; the demand realization module receives the message from the BaseInterface to realize the specific demand, and after realizing the specific demand, it passes the message to the front-end subsystem; Building the BaseInterface component includes the following steps: Create a new BaseInterface class in the project; In the BaseInterface class, define unified call tags, agentWeb and Context, and define a construction method at the same time, and the construction method parameters are agentWeb and Context. The construction method will be called in the interface loading method of the BaseWebView component; After receiving the demand call from the subsystem front-end interface, the BaseInterface component uses the entity class BaseEventCustom to distribute the demand message to the specific implementation module.
9. An electronic device, characterized in that: The electronic device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the native application integration method based on the Android modular base as claimed in any one of claims 1 to 5 are implemented.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the native application integration method based on the Android modular base as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Client native application conversion method and device, equipment and medium
CN116521170A
Method and system for describing page structure through JavaScript object
CN117454037A
A processing platform and processing method of baroapp based on environment combined hybrid app with native app
KR101585931B1