Information forwarding method, device, equipment and medium in Android system module

By using predefined information reception classes and forwarding protocols in the Android system, information is forwarded to the corresponding forwarder, which solves the problem of cumbersome information forwarding and high maintenance costs among modules, and realizes simplified information forwarding logic and improved code maintainability.

CN114490104BActive Publication Date: 2025-04-15BEIJING QICHUANG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011264954.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-12
Publication Date
2025-04-15
Estimated Expiration
2040-11-12

AI Technical Summary

Technical Problem

In the Android system, the information forwarding process between modules is cumbersome and the maintenance cost is high, mainly because different modules need to maintain multiple pre-arranged communication protocols.

Method used

Receive information through a predefined information receiving class and call the predefined forwarding protocol to forward information to the forwarder corresponding to the information type. The forwarder includes an event bus and a predefined protocol bridge, which is registered by the initialization code of the information receiving class.

Benefits of technology

It simplifies the information forwarding logic for different protocols in the module, improves the maintainability of the code, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490104B_ABST
    Figure CN114490104B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses an information forwarding method, device, equipment and medium in an Android system module, the method comprising: receiving information by using a predefined information receiving class, calling a predefined forwarding protocol through the information receiving class, so as to forward the information to a forwarder corresponding to the type of information through the forwarding protocol; forwarding the information to a business class corresponding to the content data of the information through the forwarder; wherein the forwarder comprises an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class. By calling the forwarding protocol through the information receiving class, each type of information is forwarded to the corresponding forwarder, and the forwarder is used to forward the information to the corresponding business class, so that each type of information can be forwarded in a unified manner, simplifying the information forwarding logic for different protocols in the module, improving the maintainability of the code, and reducing the maintenance cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to an information forwarding method, device, equipment and medium in an Android system module. Background Art

[0002] A program based on the Android system may include various functional modules, and each functional module may include different service classes, wherein there is a communication requirement between service classes of different modules.

[0003] In the prior art, when two business classes communicate with each other, they usually need to send and receive information through a pre-agreed unified protocol. When a business class in a module involves communicating with multiple modules, it is necessary to maintain the communication protocol pre-agreed with multiple modules in the module to which the business class belongs, so that the module can forward the received information to the business class for processing. This will make the information forwarding process within the module very cumbersome, and the maintenance of the code in the module is difficult and costly. Summary of the invention

[0004] In view of this, the embodiments of the present invention provide an information forwarding method, apparatus, device and medium in an Android system module, which can simplify the information forwarding logic for different protocols in the module, improve code maintainability and reduce maintenance costs.

[0005] In a first aspect, an embodiment of the present invention provides an information forwarding method in an Android system module, comprising:

[0006] Using a predefined information receiving class to receive information, calling a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of the information through the forwarding protocol;

[0007] The information is forwarded to a service class corresponding to the content data of the information through the forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class.

[0008] In a second aspect, an embodiment of the present invention provides an information forwarding device in an Android system module, comprising:

[0009] A first forwarding module, configured to receive information using a predefined information receiving class, and call a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of the information through the forwarding protocol;

[0010] The second forwarding module is used to forward the information to the business class corresponding to the content data of the information through the forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class.

[0011] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the information forwarding method in the Android system module as described in the first aspect above is implemented.

[0012] In a fourth aspect, an embodiment of the present invention provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, implements the information forwarding method in the Android system module as described in the first aspect above.

[0013] The embodiment of the present invention provides an information forwarding method, device, equipment and medium in an Android system module, wherein the method comprises: receiving information using a predefined information receiving class, calling a predefined forwarding protocol through the information receiving class, so as to forward the information to a forwarder corresponding to the type of information through the forwarding protocol; forwarding the information to a business class corresponding to the content data of the information through the forwarder; wherein the forwarder comprises an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class. By calling the forwarding protocol through the information receiving class, each type of information is forwarded to the corresponding forwarder, and the forwarder is used to forward the information to the corresponding business class, so that each type of information can be forwarded in a unified manner, simplifying the information forwarding logic for different protocols in the module, improving the maintainability of the code, and reducing the maintenance cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the contents of the embodiments of the present invention and these drawings without paying any creative work.

[0015] Figure 1 A schematic flow chart of an information forwarding method in an Android system module provided in Embodiment 1 of the present invention;

[0016] Figure 2 A schematic diagram of the structure of an information forwarding device in an Android system module provided in Embodiment 2 of the present invention;

[0017] Figure 3 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0018] In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved clearer, the technical solutions of the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention. In the following embodiments, each embodiment provides optional features and examples at the same time. The various features recorded in the embodiments can be combined to form multiple optional solutions, and each numbered embodiment should not be regarded as only one technical solution.

[0019] Embodiment 1

[0020] Figure 1 A flowchart of an information forwarding method in an Android system module provided in Embodiment 1 of the present invention. The information forwarding method in an Android system module disclosed in this embodiment can be applicable to the case of information forwarding within a module in an Android system, for example, the case where a functional module in an Android system forwards information received from multiple modules to the business class of the functional module. The information forwarding method in an Android system module disclosed in this embodiment can be executed by an information forwarding device in an Android system module (hereinafter referred to as an information forwarding device), which can be implemented by hardware and / or hardware, and can be configured in electronic devices, such as smart phones, computers and other electronic devices.

[0021] See also Figure 1 As shown, the information forwarding method in the Android system module includes the following steps:

[0022] S110: Receive information using a predefined information receiving class, and call a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of the information through the forwarding protocol.

[0023] Generally, various functional modules may be included in a program based on the Android system. In this embodiment, for each functional module, an information receiving class may be predefined therein, so that each functional module can uniformly receive information based on different communication protocols through the information receiving class.

[0024] The definition statement of the information receiving class may be, for example:

[0025] class MZDouyuProxy(var mContext:Context):MZBaseManager(mContext){};

[0026] The name of the information receiving class may include but is not limited to MZDouyuProxy; the information receiving class may inherit from the Base Manager class, and the name of the Base Manager class may include but is not limited to MZBaseManager; the input parameter of the information receiving class is mContext of the Context type.

[0027] In addition, a forwarding protocol can be predefined for each functional module. When the information receiving class receives information, the forwarding protocol can be called so that the forwarding protocol can forward the information to the corresponding forwarder (such as an event bus or a protocol bridge, etc.) based on the type of information, thereby facilitating the forwarding of different protocols through the corresponding forwarder.

[0028] In some optional implementations, information is forwarded to a forwarder corresponding to the type of information through a forwarding protocol, including: forwarding information to a forwarder corresponding to the type of information through a forwarding function in the forwarding protocol; wherein the input parameters of the forwarding function include the source, type, content data and extension fields of the information.

[0029] The definition statement of the forwarding protocol may be, for example:

[0030] interface ICommonMsg{

[0031] fun onMsg(from:String,type:String,msg:Any,extra:Any)

[0032] };

[0033] Among them, the name of the forwarding protocol may include but is not limited to ICommonMsg; wherein, the name of the forwarding function in the forwarding protocol may include but is not limited to onMsg; wherein, four input parameters can be abstracted from the forwarding function, and they may be from of String type, type of String type, msg of Any type, and extra of Any type. Among them, from can be used to represent the source of information, that is, the sending module of the information; type can be used to represent the type of information, and the type of information can also represent the type of the forwarder, for example, it can be an event bus type (that is, EventBus type), a protocol bridge type (that is, Interact type), or other types, etc.; msg can be used to represent the content data of the information, that is, the main content of the information, and the content data can be of any type, thereby increasing the compatibility of information forwarding; extra can be used to represent the reserved extension field, which can be of any type, thereby improving the scalability of the forwarding protocol.

[0034] In these optional implementations, by abstracting a layer of general forwarding protocol, when the information receiving class receives information from different modules, a reference relationship of the forwarding protocol can be constructed internally, and the forwarding function in the forwarding protocol can be called to forward the specific information in a unified manner, thereby effectively solving the problem of cumbersome information forwarding caused by inconsistent communication protocols of multiple modules, simplifying the information forwarding logic for different protocols within the module, improving code maintainability, and reducing maintenance costs.

[0035] S120. Forward the information to a service class corresponding to the content data of the information through a forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class.

[0036] In this embodiment, the functional modules can communicate with each other through different types of communication methods, where different types of communication methods can correspond to different types of information. For example, communication can be carried out through the event bus EventBus publish / subscribe events, or through various protocols Interact, or other communication methods. For each functional module, different types of forwarders can be constructed in advance according to different types of communication methods, so as to realize forwarding of different types of information based on different types of forwarders.

[0037] When the forwarder is EventBus, the information receiving class can be registered in the event bus when the initial code is initialized. In some optional implementations, the step of registering the event bus through the initialization code in the information receiving class includes: when the initialization code in the information receiving class determines that the information receiving class has not completed registration, calling the registration method of the event bus to complete the registration logic of the event bus.

[0038] The initialization code in the information receiving class may include, for example, the following statement:

[0039]

[0040] Among them, the name of the initialization code may include but is not limited to init; among them, in the init code block, this may represent the information receiving class, and you can first call the EventBus.getDefault().isRegistered(this) method to determine whether the information receiving class has been registered in the EventBus event bus; if it is not registered, you can complete the registration logic by calling the registration method EventBus.getDefault().register(this).

[0041] In these optional implementations, the initialization code can be used to automatically register the information receiving class in the EventBus event bus, thereby reducing the implementation cost. By completing the above registration logic, the information receiving class can perform information sending and receiving processing based on the EventBus related protocol.

[0042] In some further implementations, the information forwarding method further includes: when it is determined through an activity end method in the information receiving class that the information receiving class has completed registration, a deregistration method of the event bus is called to complete the deregistration logic of the event bus.

[0043] If only the registration logic of the information receiving class is performed, but the deregistration logic of the information receiving class is not performed, it will easily cause memory leakage. Therefore, in these further implementations, the information receiving class corresponding to the functional module can be deregistered when the activity page Activity corresponding to the functional module is destroyed, thereby avoiding the problem of memory leakage.

[0044] The activity ending method in the information receiving class may be, for example:

[0045]

[0046] Among them, when the activity page Activity is destroyed, the activity end method onActivityFinish() overridden in the information receiving class can be called; among them, in onActivityFinish(), this can represent the information receiving class, and the EventBus.getDefault().isRegistered(this) method can be called first to determine whether the information receiving class has been registered in the EventBus event bus; if it has been registered, the unregistration method EventBus.getDefault().unregister(this) can be called to complete the unregistration logic.

[0047] In these further implementations, if it is determined that the information receiving class is not registered in the EventBus event bus, then the deregistration logic may not be performed, thereby effectively avoiding abnormal problems caused by deregistering the information receiving class that is not registered in the EventBus.

[0048] In some further embodiments, if the forwarder is an event bus, the information is forwarded to the business class corresponding to the content data of the information through the forwarder, including: determining the subscription method and subscription business class corresponding to the content data of the information through the event bus, and forwarding the information to the subscription business class through the subscription method.

[0049] When registering the information receiving class to the event bus, you can operate on the map data with the subscriber class as the key and the event class as the value, so that you can use each business class in the information receiving class as a subscriber and build a collection association between each subscriber and the subscription event. In addition, during the registration process, you can also pass in the subscription method corresponding to each subscription event.

[0050] In these optional implementations, the subscription method and subscription service class corresponding to the content data of the information (ie, the specific event) can be determined through the event bus, so that the information can be forwarded to the subscription service class through the subscription method.

[0051] In some further embodiments, if the forwarder is a protocol bridge, the information is forwarded to a business class corresponding to the content data of the information through the forwarder, including: determining a protocol communication method corresponding to the content data of the information through the protocol bridge, and forwarding the information to the corresponding business class through the protocol communication method.

[0052] The predefined statements of the protocol bridge may include, for example:

[0053]

[0054]

[0055] Among them, the name of the protocol bridge may include but is not limited to Interact; wherein, at least one protocol communication method may be copied in Interact, such as onModuleAMsg, onModuleBMsg and onModuleCMsg, etc.; wherein, the input parameter of each protocol communication method may include an any type data xxx, wherein the specific data value may be determined by the interaction content between each module.

[0056] In these optional implementations, the protocol communication method corresponding to the content data of the information can be determined through the protocol bridge, and the information can be forwarded to the business class included in the protocol method through the protocol communication method.

[0057] The present embodiment provides an information forwarding method in an Android system module, which uses a predefined information receiving class to receive information, and calls a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of information through the forwarding protocol; through the forwarder, the information is forwarded to a business class corresponding to the content data of the information; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class. By calling the forwarding protocol through the information receiving class, each type of information is forwarded to the corresponding forwarder, and the forwarder is used to forward the information to the corresponding business class, it is possible to achieve a unified way to forward each type of information, simplify the information forwarding logic for different protocols in the module, improve the maintainability of the code, and reduce the maintenance cost.

[0058] Embodiment 2

[0059] Figure 2 The schematic diagram of the structure of an information forwarding device in an Android system module provided in the second embodiment of the present invention. The information forwarding device provided in the embodiment of the present invention can be applied to the situation of information forwarding within a module in an Android system, for example, the situation where a function module in an Android system forwards information sent by multiple other modules to the service class of the function module.

[0060] See also Figure 2 As shown, the information forwarding device in the Android system module includes:

[0061] A first forwarding module 210, configured to receive information using a predefined information receiving class, and call a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of the information through the forwarding protocol;

[0062] The second forwarding module 220 is used to forward the information to the business class corresponding to the content data of the information through a forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class.

[0063] In some optional implementations, the information receiving class inherits from the Base Manager class, and the input parameter of the information receiving class is of Context type.

[0064] In some optional implementations, the information forwarding device further includes:

[0065] The event bus registration module is used to register the event bus through the initialization code in the information receiving class;

[0066] The event bus module is specifically used to: when it is determined through the initialization code in the information receiving class that the information receiving class has not completed registration, call the registration method of the event bus to complete the registration logic of the event bus.

[0067] In some optional implementations, the information forwarding device further includes:

[0068] The event bus deregistration module is used to call the event bus deregistration method to complete the event bus deregistration logic when it is determined that the information receiving class has completed registration through the activity end method in the information receiving class.

[0069] In some optional implementations, the first forwarding module is specifically configured to:

[0070] The information is forwarded to a forwarder corresponding to the type of the information through a forwarding function in the forwarding protocol; wherein the input parameters of the forwarding function include the source, type, content data and extension field of the information.

[0071] In some optional implementations, if the forwarder is an event bus, the second forwarding module is specifically used to:

[0072] Through the event bus, the subscription method and subscription business class corresponding to the content data of the information are determined, and the information is forwarded to the subscription business class through the subscription method.

[0073] In some optional implementations, if the forwarder is a protocol bridge, the second forwarding module is specifically configured to:

[0074] The protocol communication method corresponding to the content data of the information is determined through the protocol bridge, and the information is forwarded to the corresponding business class through the protocol communication method.

[0075] The information forwarding device in the Android system module provided in the embodiment of the present invention can execute the information forwarding method in the Android system module provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail, please refer to the information forwarding method in the Android system module provided in any embodiment of the present invention.

[0076] Embodiment 3

[0077] Figure 3 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. Figure 3 A block diagram of an exemplary electronic device 12 suitable for implementing any of the embodiments of the present invention is shown. Figure 3 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention. The device 12 is typically an electronic device responsible for information forwarding in the Android system module.

[0078] like Figure 3 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 connecting the various components (including the memory 28 and the processing unit 16).

[0079] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.

[0080] The electronic device 12 typically includes a variety of computer readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0081] The memory 28 may include computer device readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 3 not shown, usually called a "hard drive"). Although Figure 3 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product 40, which has a set of program modules 42, which are configured to perform the functions of various embodiments of the present invention. The program product 40 may be stored in, for example, the memory 28, and such program modules 42 include, but are not limited to, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment. The program module 42 generally performs the functions and / or methods in the embodiments described in the present invention.

[0082] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, mouse, camera, etc., and display), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. In addition, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 through a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) devices, tape drives, and data backup storage devices.

[0083] The processor 16 executes various functional applications and data processing by running the program stored in the memory 28, for example, implementing the distribution method of the protocol provided in the above embodiment of the present invention, the method comprising:

[0084] Receive information using a predefined information receiving class, call a predefined forwarding protocol through the information receiving class, and forward the information to a forwarder corresponding to the type of information through the forwarding protocol; forward the information to a business class corresponding to the content data of the information through the forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class.

[0085] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the protocol distribution method provided in any embodiment of the present invention.

[0086] Embodiment 4

[0087] Embodiment 4 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the information forwarding method in the Android system module provided in the embodiment of the present invention is implemented. The method includes:

[0088] Receive information using a predefined information receiving class, call a predefined forwarding protocol through the information receiving class, and forward the information to a forwarder corresponding to the type of information through the forwarding protocol; forward the information to a business class corresponding to the content data of the information through the forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class.

[0089] Of course, the computer-readable storage medium provided by an embodiment of the present invention stores a computer program which is not limited to the above method operations, but can also execute related operations in the information forwarding method in the Android system module provided by any embodiment of the present invention.

[0090] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0091] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0092] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0093] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0094] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. An information forwarding method in an Android system module, characterized in that: include: Using a predefined information receiving class to receive information, calling a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of the information through the forwarding protocol; The information is forwarded to a service class corresponding to the content data of the information through the forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class; The information receiving class inherits from the Base Manager class, and the input parameter of the information receiving class is of Context type; wherein the name of the protocol bridge is Interact, wherein at least one protocol communication method is replicated in Interact, wherein the input parameter of each protocol communication method includes an any type of data; The step of registering the event bus through the initialization code in the information receiving class includes: When it is determined through the initialization code in the information receiving class that the information receiving class has not completed registration, the registration method of the event bus is called to complete the registration logic of the event bus.

2. The method according to claim 1, characterized in that Also includes: When it is determined through the activity end method in the information receiving class that the information receiving class has completed registration, the deregistration method of the event bus is called to complete the deregistration logic of the event bus.

3. The method according to claim 1, characterized in that The forwarding of the information to a forwarder corresponding to the type of the information by using the forwarding protocol includes: The information is forwarded to a forwarder corresponding to the type of the information through a forwarding function in the forwarding protocol; wherein the input parameters of the forwarding function include the source, type, content data and extension field of the information.

4. The method according to claim 1, characterized in that: If the forwarder is an event bus, forwarding the information to a service class corresponding to the content data of the information through the forwarder includes: The subscription method and subscription service class corresponding to the content data of the information are determined through the event bus, and the information is forwarded to the subscription service class through the subscription method.

5. The method according to claim 1, characterized in that If the forwarder is a protocol bridge, the forwarding of the information to a service class corresponding to the content data of the information through the forwarder includes: The protocol bridge determines the protocol communication method corresponding to the content data of the information, and forwards the information to the corresponding service class through the protocol communication method.

6. An information forwarding device in an Android system module, characterized in that: include: A first forwarding module, configured to receive information using a predefined information receiving class, and call a predefined forwarding protocol through the information receiving class to forward the information to a forwarder corresponding to the type of the information through the forwarding protocol; A second forwarding module, configured to forward the information to a service class corresponding to the content data of the information through the forwarder; wherein the forwarder includes an event bus and a predefined protocol bridge, and the event bus is registered through the initialization code in the information receiving class; The information receiving class inherits from the Base Manager class, and the input parameter of the information receiving class is of Context type; wherein the name of the protocol bridge is Interact, wherein at least one protocol communication method is replicated in Interact, wherein the input parameter of each protocol communication method includes an any type of data; The event bus registration module is used to register the event bus through the initialization code in the information receiving class; The event bus module is specifically used to: when it is determined through the initialization code in the information receiving class that the information receiving class has not completed registration, call the registration method of the event bus to complete the registration logic of the event bus.

7. An electronic 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 information forwarding method in the Android system module as described in any one of claims 1-5 is implemented.

8. A storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, implement the information forwarding method in an Android system module as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Decoupling method and system based on interaction between Android service modules

    CN107273138A

  • Secure and anonymous messaging system and method

    US20170103488A1