Message processing method, device, equipment and storage medium based on Android system

By obtaining pending messages in the Android system and determining the received page objects from the page object storage pool for unified forwarding, the problems of complex message bus design and large performance overhead in the prior art are solved, and efficient message processing and simplified development process are realized.

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

Patent Information

Application Number
CN202010436361.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-21
Publication Date
2025-04-08
Estimated Expiration
2040-05-21

AI Technical Summary

Technical Problem

The message processing methods in the existing Android system lead to complex message bus design, low development efficiency, high performance overhead, and multiple message receiver settings increase development difficulty and equipment operation energy consumption.

Method used

By obtaining pending messages based on the Android system, based on the received page object identification in the message, the received page object is determined from the page object storage pool of the key-value pair structure, and its message forwarding function is called to forward the message to each received page object, realizing unified forwarding of different message processing mechanisms.

Benefits of technology

It simplifies the message processing process, improves development efficiency and message processing efficiency, reduces the energy consumption of equipment operation, and avoids the complexity and performance overhead brought by multiple message processing mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113703989B_ABST
    Figure CN113703989B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a message processing method, device, equipment and storage medium based on the Android system. The method includes: obtaining a message to be processed, the message to be processed is a message based on any message processing mechanism in the Android system; according to the receiving page object identifier in the message to be processed, determining at least one receiving page object from a page object storage pool of a key-value pair structure, the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects; using the message to be processed as an input parameter, calling the message forwarding function of the receiving page object respectively, forwarding the message to be processed to each receiving page object, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms. Through the above technical solution, it is realized to more efficiently receive and forward messages of different message processing mechanisms in the Android system, and reduce the energy consumption of equipment operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to computer technology, and in particular to a message processing method, apparatus, device and storage medium based on an Android system. Background Art

[0002] There are various message processing mechanisms in the Android development process, such as the broadcast message mechanism and the listener message mechanism that implement message processing through broadcasting or listeners.

[0003] If you use these message processing mechanisms for development, you need to design a message bus to receive and forward messages. In addition, if a module needs to receive multiple messages based on different message processing mechanisms, then when developing the module, you need to design a message receiver that corresponds to each message processing mechanism.

[0004] The existing message processing method will cause the following problems: the message bus design is complex, the development efficiency is low, and the performance overhead of the message bus in the message processing process is large; in addition, the setting of multiple message receivers will also increase the development difficulty, reduce development efficiency and increase equipment operation energy consumption. Summary of the invention

[0005] The embodiments of the present invention provide a message processing method, apparatus, device and storage medium based on the Android system, so as to more efficiently receive and forward messages of different message processing mechanisms in the Android system and reduce the energy consumption of device operation.

[0006] In a first aspect, an embodiment of the present invention provides a message processing method based on an Android system, comprising:

[0007] Obtain a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system;

[0008] According to the received page object identifier in the to-be-processed message, at least one received page object is determined from a page object storage pool of a key-value pair structure, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on a page object monitoring method;

[0009] The message to be processed is used as an input parameter, and the message forwarding function of the receiving page object is called respectively to forward the message to be processed to each of the receiving page objects, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms.

[0010] In a second aspect, an embodiment of the present invention further provides a message processing device based on an Android system, the device comprising:

[0011] A message acquisition module, used to acquire a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system;

[0012] A receiving page object determining module, configured to determine at least one receiving page object from a page object storage pool of a key-value pair structure according to a receiving page object identifier in the message to be processed, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on a page object monitoring method;

[0013] The message forwarding module is used to take the message to be processed as an input parameter, call the message forwarding function of the receiving page object respectively, and forward the message to be processed to each of the receiving page objects to achieve unified forwarding of the messages to be processed of different message processing mechanisms.

[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0015] one or more processors;

[0016] a storage device for storing one or more programs,

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method based on the Android system provided by any embodiment of the present invention.

[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the message processing method based on the Android system provided by any embodiment of the present invention.

[0019] The embodiment of the present invention obtains a pending message based on any message processing mechanism in the Android system; determines at least one receiving page object from a page object storage pool of a key-value pair structure according to a receiving page object identifier in the pending message, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on a page object monitoring method; takes the pending message as an input parameter, and calls the message forwarding function of the receiving page object respectively, and forwards the pending message to each receiving page object, so as to realize the unified forwarding of pending messages of different message processing mechanisms. The design of a message processing proxy container that replaces the message bus in the Android system is realized, which can receive pending messages processed based on various message processing mechanisms, and can forward the pending message to all pages that need to receive the pending message, unifies the message processing method in the Android system, avoids the problems of high development difficulty and high performance overhead caused by multiple message processing mechanisms, simplifies the message processing process, improves development efficiency, and improves message processing efficiency, and reduces equipment operation energy consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a flow chart of a message processing method based on the Android system in Embodiment 1 of the present invention;

[0021] Figure 2 It is a flow chart of a method for constructing a page object storage pool in a message processing method based on an Android system in Embodiment 2 of the present invention;

[0022] Figure 3 This is a flowchart of a message processing method based on the Android system in Embodiment 3 of the present invention;

[0023] Figure 4 This is a schematic diagram of the structure of a message processing device based on the Android system in Embodiment 3 of the present invention;

[0024] Figure 5 It is a structural schematic diagram of an electronic device in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0026] Embodiment 1

[0027] The message processing method based on the Android system provided in this embodiment can be applied to the reception and forwarding processing of any message in the Android system. The method can be executed by a message processing device based on the Android system, which can be implemented by software and / or hardware, and can be integrated in an electronic device running the Android system, such as a mobile phone, a tablet computer or a smart TV. Figure 1 , the method of this embodiment specifically includes:

[0028] S110, obtaining a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system.

[0029] Among them, the message processing mechanism refers to a mechanism for message processing, such as a broadcast message mechanism and a listener message mechanism. The message to be processed can be a message processed using any of the original message processing mechanisms. Exemplarily, the message to be processed is a system message based on the broadcast message mechanism in the Android system, a business message based on the broadcast message mechanism or the listener message mechanism, or a display interface update message based on the broadcast message mechanism or the listener message mechanism. The message to be processed can be a business message (such as a bullet message, a comment message, a real-time interactive message, etc.), a system message (such as a message required for the operation of the Android system), and a display interface update message (such as a message to update a picture in the UI interface, etc.).

[0030] Specifically, in the embodiment of the present invention, a message proxy container for message processing is designed, which is used to replace the message bus and various message processing mechanisms in the Android system, and is specifically used to receive messages, maintain page objects that need to receive messages, and forward received messages to corresponding page activity objects, thereby unifying the message processing method in the Android system. During specific implementation, the message proxy container needs to receive any pending message delivered to the Android client.

[0031] S120. Determine at least one received page object from a page object storage pool of a key-value pair structure based on a received page object identifier in the message to be processed, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on a page object monitoring method.

[0032] Among them, the receiving page object identifier refers to the identifier of the page object (i.e., the receiving page object) used to receive the message, for example, it can be the name of the receiving page object, activityName. The page object storage pool refers to a data storage pool that stores multiple page objects, which is used to maintain the page objects that need to receive messages. In order to improve data access efficiency, the key-value pair structure is used to design the page object storage pool in this embodiment. Considering that there are multiple page objects created based on a page class activity in an application, and the page object identifiers of these page objects are the same, if the page object identifier is used as the key information in the page object storage pool, then these page objects will overwrite each other and only the last one will be stored, resulting in the covered page object being unable to receive messages later. Therefore, the key-value pair structure in this embodiment needs to adopt a non-overlapping design. The page object monitoring method refers to a pre-designed monitoring method for monitoring the creation and destruction of page objects, for example, it can be a manual point monitoring method, or it can be a method of automatic monitoring using the page monitoring interface provided by the system. The active page object refers to a page activity object that has been created and not destroyed.

[0033] Specifically, in order to maintain multiple page objects of received messages, the message proxy container needs to pre-establish a page object storage pool and set a page object monitoring mode, so that when a page object is created, it is stored in the page object storage pool without overwriting, and when a page object is destroyed, it is promptly deleted from the page object storage pool to achieve dynamic maintenance of page objects. In this way, when the message proxy container obtains the message to be processed, it obtains the received page object identifier through message parsing. Then, based on the received page object identifier, multiple key information is generated, and each key information is used to query its corresponding value information, that is, the page object, from the page object storage pool. These queried page objects are all used as receiving page objects for receiving messages to be processed.

[0034] Exemplarily, the page object monitoring method is: taking the target callback variable as the input parameter, calling the page life cycle callback function in the target application class object, and monitoring the calls of the page object creation function and / or page object destruction function of each page object in the target application class object, so as to monitor the creation and destruction operations of each page object.

[0035] Among them, the target callback variable callbacks is a variable of the page lifecycle callback interface ActivityLifecycleCallback type, and the page creation function onActivityCreated() and the page destruction function onActivityDestroyed() in the page lifecycle callback interface are overwritten in the target callback variable.

[0036] Specifically, this embodiment adopts an automatic monitoring method based on the page monitoring interface provided by the system. First, define a target application class DYApplication that inherits the Application class provided by the Android system through the extends method. The specific code implementation can be: Class DYApplication extends Application{}. Then, define a target application class object application of the Application type in the DYApplication class, such as declaring it in the private Application application method. Then, override the onCreate lifecycle method in the Application class in the DYApplication class, for example:

[0037] @Override

[0038] public void onCreate(){}.

[0039] The @Override keyword here means overriding. In the onCreate function, the super.onCreate() function is called to execute the oncreat method in the Application class, and then the this.application=this function is called to assign the this pointer of the DYApplication object to the target application class object application to complete the initialization of the target application class object application.

[0040] After that, monitor the life cycle function information in the system. The specific monitoring process is as follows:

[0041] First, define a target callback variable callbacks of the page lifecycle callback interface ActivityLifecycleCallbacks type, where ActivityLifecycleCallbacks type is a type variable provided by the Android system, which is an interface type. Then, instantiate callbacks. Since callbacks is an interface type, all interfaces in it need to be copied during instantiation. The specific instantiation implementation example is as follows:

[0042]

[0043]

[0044] The main things to pay attention to are the page object creation function onActivityCreated and the page object destruction function onActivityDestroyed, which are called when the page is created and destroyed respectively. And the system will pass the activity as a parameter to the corresponding function, and the activity parameter represents the corresponding start / destroy page.

[0045] After that, the target callback variable is mounted through Application.registerActivityLifecycleCallbacks(callbacks) so that the system can identify and mount the target callback variable callbacks. In this way, all page objects started or destroyed in the system can be monitored through the call of their page object creation function or page object destruction function. The advantage of this setting is that it improves the convenience and efficiency of page object monitoring and ensures the comprehensiveness of page object monitoring.

[0046] S130, taking the message to be processed as an input parameter, respectively calling the message forwarding function of the receiving page object, and forwarding the message to be processed to each receiving page object, so as to achieve unified forwarding of the messages to be processed of different message processing mechanisms.

[0047] Specifically, the message forwarding operation of the message proxy container requires the design of a message forwarding interface, and each page object inherits the message forwarding interface and implements the message forwarding function in the interface. In this way, when the message proxy container obtains the reference relationship of the receiving page object through the page object storage pool, it will call the message forwarding function onMsg(msg) through each receiving page object, with the message to be processed msg as the function input parameter, and forward the message to be processed to each receiving page object.

[0048] The technical solution of this embodiment is to obtain a pending message based on any message processing mechanism in the Android system; determine at least one receiving page object from the page object storage pool of the key-value pair structure according to the receiving page object identifier in the pending message, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on the page object monitoring method; take the pending message as an input parameter, call the message forwarding function of the receiving page object respectively, and forward the pending message to each receiving page object, so as to realize the unified forwarding of pending messages of different message processing mechanisms. The design of the message processing proxy container that replaces the message bus in the Android system is realized, which can receive pending messages processed based on various message processing mechanisms, and can forward the pending message to all pages that need to receive the pending message, unify the message processing method in the Android system, avoid the problems of high development difficulty and high performance overhead caused by multiple message processing mechanisms, not only simplify the message processing process, improve development efficiency, but also improve message processing efficiency and reduce equipment operation energy consumption.

[0049] Embodiment 2

[0050] This embodiment further optimizes the construction of the "page object storage pool" based on the above embodiment 1. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.

[0051] See also Figure 2 The page object storage pool construction method in the message processing method based on the Android system provided in this embodiment includes:

[0052] S210. Create and initialize a page object storage pool based on a key-value pair map structure.

[0053] Specifically, in the related art, the processing of collections is usually processed by list collections, which will result in the need to traverse the collection every time a page object in the collection is obtained, resulting in very low data access efficiency. In this embodiment, a page object storage pool with a map structure is defined, and the page objects that need to receive messages are stored in the page object storage pool. In specific implementation, the page object storage pool activityMap is defined and initialized through the HashMap constructor, such as HashMap<String,Activity> activityMap=new HashMap().

[0054] S220: When a page object creation operation is monitored based on the page object monitoring mode, the created page object identifier is used as the first current page object identifier of the same page class.

[0055] The created page object identifier is the identifier of the newly created page object (ie, the created page object). The first current page object identifier is the current page object identifier during the object storage process to the storage pool. The current page object identifier is the identifier of the page object being processed in the current operation.

[0056] Specifically, when the message proxy container monitors that the page object creation function is called, it determines that the page object creation operation is monitored. At this time, the creation page object identifier activityName is used as the first current page object identifier of the page activity class corresponding to the creation page object.

[0057] S230: Using the first current page object identifier as an input parameter, calling a key information query function of a page object storage pool to determine whether a page object using the first current page object identifier as key information has been stored in the page object storage pool.

[0058] Specifically, with the first current page object identifier activityName as the function input parameter, the key information query function contains() of the page object storage pool activityMap is called, that is, activityMap.contains(activityName), to determine whether the page object with the first current page object identifier activityName as the key information is stored in the page object storage pool activityMap.

[0059] S240: If yes, update the first current page object identifier using the creation page object identifier and the next level identifier of the key information level identifier of the first current page object identifier, and return to execute S230.

[0060] Among them, the key information level identifier refers to an identifier that characterizes the level of key information corresponding to the same page class, which is used to distinguish different page objects of the same page class in the page object storage pool, and is reflected by creating a prefix or suffix of the page object identifier in the first current page object identifier. The next level identifier refers to the level identifier of the next level of the key information level identifier. The element composition structure of the key information level identifier and the next level identifier is the same. Exemplarily, the next level identifier is composed of a preset string connector and a number. For example, the preset string connector is an underscore "_", the key information level identifier of the first current page object identifier is empty, and it defaults to "_0", then the next level identifier is "_1".

[0061] Specifically, if the page object storage pool activityMap has stored a page object with the first current page object identifier activityName as key information, then according to the key information level identifier "_0" of the first current page object identifier activityName, the next level identifier is determined to be "_1", and the updated first current page object identifier is "activityName_1". After that, return to execute S230 to form a key information query loop until it is determined that the page object storage pool activityMap does not store a page object with the first current page object identifier as key information, and then execute S250.

[0062] S250: If not, then take the first current page object identifier and the created page object as input parameters, call the object storage function of the page object storage pool, and store the first current page object identifier and the created page object as key information and value information in the page object storage pool respectively.

[0063] Specifically, if it is determined that the page object with the first current page object identifier as the key information is not stored in the page object storage pool activityMap, then the first current page object identifier (assumed to be "activityName_n") and the creation page object activity are used as function input parameters, and the object storage function put() of the page object storage pool activityMap is called, that is, activityMap.put(activityName_n,activity), and the first current page object identifier activityName_n is used as the key information, and the creation page object activity is used as the corresponding value information, and the pairs are stored in the page object storage pool.

[0064] S260. When a page object destruction operation is detected based on the page object monitoring mode, the object deletion function of the page object storage pool is called with the page object destruction identifier containing the level key information identifier of the destroyed page object as an input parameter to delete the destroyed page object from the page object storage pool.

[0065] Specifically, when the message proxy container monitors that the page destruction function of a certain page object is called, it monitors the destruction operation of the page object (i.e., the destroyed page object). At this time, the message proxy container needs to obtain the key information of the destroyed page object in the page object storage pool, i.e., the destroyed page object identifier. For example, the class object acquisition function getClass(), i.e., activity.getClass(), is called by the destroyed page object activity to obtain the class object cls of the Class type corresponding to the destroyed page object activity; then, the object name acquisition function getSimpleName(), i.e., cls.getSimpleName(), of the class object cls is called to obtain the name activityName_m of the destroyed page object activity as the destroyed page object identifier. Then, the message proxy container uses the destroyed page object identifier activityName_m as the function input parameter, and calls the object deletion function remove() of the page object storage pool activityMap, i.e., activityMap.remove(activityName_m), to delete the destroyed page object from the page object storage pool activityMap.

[0066] It should be noted that the operation of dynamically maintaining the page object storage pool in this embodiment runs through the entire process of message processing. As long as there are page object creation and destruction operations, the dynamic maintenance process of the page object storage pool will be triggered. There is no restriction on the order of execution between the dynamic maintenance process and the message reception and forwarding process, and the two can also be executed in parallel.

[0067] The technical solution of this embodiment is as follows: when a page object creation operation is monitored based on a page object monitoring method, the created creation page object identifier is used as the first current page object identifier of the same page class; the key information query function of the page object storage pool is called with the first current page object identifier as an input parameter to determine whether a page object with the first current page object identifier as key information has been stored in the page object storage pool; if so, the first current page object identifier is updated using the creation page object identifier and the next level identifier of the key information level identifier of the first current page object identifier, and the step of returning to execute the call of the key information query function of the page object storage pool with the first current page object identifier as an input parameter to determine whether a page object with the first current page object identifier as key information has been stored in the page object storage pool; if not, the object storage function of the page object storage pool is called with the first current page object identifier and the creation page object as input parameters, and the first current page object identifier and the creation page object are respectively stored in the page object storage pool as key information and value information. When a page object based on the same page class is created, it is added to the page object storage pool of the map structure without overwriting, ensuring that all created and undestroyed active page objects are stored in the page object storage pool, improving the comprehensiveness of active page objects, thereby improving the accuracy of message forwarding. In addition, all active page objects are stored in the page object storage pool of the map structure, which improves the convenience of accessing page objects, thereby further improving the efficiency of message forwarding. When a page object destruction operation is monitored based on the page object monitoring method, the page object destruction object identifier containing the level key information identifier of the destroyed page object is used as an input parameter, and the object deletion function of the page object storage pool is called to delete the destroyed page object from the page object storage pool. The timely clearing of inactive page objects in the page object storage pool is achieved, further ensuring the accuracy and effectiveness of page objects in the page object storage pool, thereby further improving the accuracy of message forwarding.

[0068] Embodiment 3

[0069] Based on the above-mentioned embodiment 2, this embodiment further optimizes "determining at least one receiving page object from a page object storage pool of a key-value pair structure according to the receiving page object identifier in the message to be processed". The explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.

[0070] See also Figure 3 The message processing method based on the Android system provided in this embodiment includes:

[0071] S310: Obtain a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system.

[0072] S320. Use the received page object identifier in the message to be processed as the second current page object identifier of the same page class, and use the second current page object identifier as an input parameter to call the key information query function of the page object storage pool to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool.

[0073] The second current page object identifier refers to the current page object identifier in the process of forwarding the message.

[0074] Specifically, since the object identifiers of multiple page objects of the same page class are the same, each received page object identifier carried in the to-be-processed message may correspond to multiple received page objects. Based on this, in this embodiment, it is necessary to search for all page objects of a page class corresponding to each received page object identifier from the page object storage pool based on each received page object identifier. That is, S320 to S340 are executed for each received page object identifier.

[0075] In the specific implementation, first, the message proxy container uses a certain receiving page object identifier A as the second current page object identifier. Then, the key information query function contains() of the page object storage pool activityMap is called with the second current page object identifier A as the function input parameter, that is, activityMap.contains(A), to determine whether the page object storage pool activityMap stores a page object with the second current page object identifier A as the key information.

[0076] S330: If yes, then use the second current page object identifier as an input parameter to call the object acquisition function of the page object storage pool to obtain the receiving page object corresponding to the second current page object identifier.

[0077] Specifically, if the page object storage pool activityMap stores a page object with the second current page object identifier A as key information, then the object acquisition function get() of the page object storage pool activityMap, that is, activityMap.get(A), is called with the second current page object identifier A as the input parameter to obtain the receiving page object corresponding to the second current page object identifier.

[0078] S340, update the second current page object identifier using the next level identifier of the key information level identifier in the received page object identifier and the second current page object identifier, and return to execute S320 until it is determined that no page object with the second current page object identifier as key information is stored in the page object storage pool.

[0079] Specifically, after obtaining the receiving page object corresponding to the second current page object identifier, the receiving page object identifier "A" and the next level identifier "_1" of the key information level identifier "_0" in the second current page object identifier are used to determine the updated second current page object identifier "A_1". Then, return to execute S320, that is, call activityMap.contains(A_1) to determine whether the page object storage pool stores a page object with the second current page object identifier "A_1" as key information, and when the corresponding page object is stored in the page object storage pool, obtain the page object, and so on, forming a loop operation of page object query and acquisition, until the page object storage pool does not store a page object with the second current page object identifier as key information, so as to obtain multiple page objects belonging to the same page class as multiple receiving page objects.

[0080] S350, taking the message to be processed as an input parameter, respectively calling the message forwarding function of the receiving page object, and forwarding the message to be processed to each receiving page object, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms.

[0081] The technical solution of this embodiment is to use the received page object identifier as the second current page object identifier of the same page class, and use the second current page object identifier as an input parameter to call the key information query function of the page object storage pool to determine whether the page object storage pool stores a page object with the second current page object identifier as key information; if so, use the second current page object identifier as an input parameter to call the object acquisition function of the page object storage pool to obtain the received page object corresponding to the second current page object identifier; update the second current page object identifier using the next level identifier of the key information level identifier in the received page object identifier and the second current page object identifier, and return to execute the step of calling the key information query function of the page object storage pool with the second current page object identifier as an input parameter to determine whether the page object storage pool stores a page object with the second current page object identifier as key information, until it is determined that the page object storage pool does not store a page object with the second current page object identifier as key information. The acquisition of all received page objects corresponding to the pending message is achieved, the comprehensiveness of the received page objects is improved, and the forwarding accuracy and efficiency of the pending message are further improved.

[0082] Embodiment 4

[0083] This embodiment provides a message processing device based on the Android system. Figure 4 , the device specifically comprises:

[0084] The message acquisition module 410 is used to acquire a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system;

[0085] The receiving page object determining module 420 is used to determine at least one receiving page object from a page object storage pool of a key-value pair structure according to the receiving page object identifier in the message to be processed, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on the page object monitoring method;

[0086] The message forwarding module 430 is used to take the message to be processed as an input parameter, call the message forwarding function of the receiving page object respectively, and forward the message to be processed to each receiving page object, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms.

[0087] Optionally, the message to be processed is a system message based on the broadcast message mechanism in the Android system, a business message based on the broadcast message mechanism or the listener message mechanism, or a display interface update message based on the broadcast message mechanism or the listener message mechanism.

[0088] Optionally, based on the above device, the device further includes a page object storage pool maintenance module, which is used to:

[0089] Create and initialize the page object storage pool based on the key-value pair map structure;

[0090] When a page object creation operation is monitored based on the page object monitoring mode, the created page object identifier is used as the first current page object identifier of the same page class;

[0091] Taking the first current page object identifier as an input parameter, calling the key information query function of the page object storage pool to determine whether the page object with the first current page object identifier as key information has been stored in the page object storage pool;

[0092] If so, the first current page object identifier is updated using the next level identifier of the key information level identifier of the creation page object identifier and the first current page object identifier, and the step of returning to execute the key information query function of the page object storage pool with the first current page object identifier as an input parameter to determine whether a page object with the first current page object identifier as key information has been stored in the page object storage pool;

[0093] If not, the object storage function of the page object storage pool is called with the first current page object identifier and the created page object as input parameters, and the first current page object identifier and the created page object are respectively stored in the page object storage pool as key information and value information.

[0094] Furthermore, the page object storage pool maintenance module is also used to:

[0095] After the page object storage pool is created and initialized based on the key-value pair map structure, when the page object destruction operation is monitored based on the page object monitoring method, the object deletion function of the page object storage pool is called with the destroyed page object identifier containing the level key information identifier of the destroyed page object as the input parameter to delete the destroyed page object from the page object storage pool.

[0096] Optionally, the receiving page object determination module 420 is specifically configured to:

[0097] The received page object identifier is used as the second current page object identifier of the same page class, and the second current page object identifier is used as an input parameter to call the key information query function of the page object storage pool to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool;

[0098] If yes, then the object acquisition function of the page object storage pool is called with the second current page object identifier as an input parameter to obtain the receiving page object corresponding to the second current page object identifier;

[0099] The second current page object identifier is updated using the next level identifier of the key information level identifier in the received page object identifier and the second current page object identifier, and the step of returning to execute the key information query function of the page object storage pool with the second current page object identifier as an input parameter to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool, until it is determined that no page object with the second current page object identifier as key information is stored in the page object storage pool.

[0100] Optionally, the next level identifier is composed of a preset string connector and a number.

[0101] Optionally, the page object monitoring method is:

[0102] Using the target callback variable as an input parameter, the page lifecycle callback function in the target application class object is called, and the page object creation function and / or page object destruction function of each page object in the target application class object are monitored to realize the creation operation and destruction operation of each page object;

[0103] The target callback variable is a variable of the page life cycle callback interface type, and the page creation function and the page destruction function in the page life cycle callback interface are overwritten in the target callback variable.

[0104] Through a message processing device based on an Android system in the fourth embodiment of the present invention, a design of a message processing proxy container that replaces the message bus in the Android system is implemented. The device can receive pending messages processed based on various message processing mechanisms, and can forward the pending messages to all pages that need to receive the pending messages. This unifies the message processing methods in the Android system, avoids the problems of high development difficulty and high performance overhead caused by multiple message processing mechanisms, simplifies the message processing process, improves development efficiency, and improves message processing efficiency, thereby reducing equipment operation energy consumption.

[0105] The message processing device based on the Android system provided in the embodiment of the present invention can execute the message processing method based on the Android system provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0106] It is worth noting that in the above-mentioned embodiment of the message processing device based on the Android system, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0107] Embodiment 5

[0108] See also Figure 5 This embodiment provides an electronic device 500, which includes: one or more processors 520; a storage device 510, which is used to store one or more programs. When the one or more programs are executed by the one or more processors 520, the one or more processors 520 implement the message processing method based on the Android system provided by the embodiment of the present invention, including:

[0109] Obtain a pending message, wherein the pending message is a message based on any message processing mechanism in the Android system;

[0110] According to the receiving page object identifier in the message to be processed, at least one receiving page object is determined from a page object storage pool of a key-value pair structure, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on the page object monitoring method;

[0111] With the message to be processed as the input parameter, the message forwarding function of the receiving page object is called respectively to forward the message to be processed to each receiving page object, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms.

[0112] Of course, those skilled in the art can understand that the processor 520 can also implement the technical solution of the message processing method based on the Android system provided by any embodiment of the present invention.

[0113] Figure 5 The electronic device 500 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.

[0114] like Figure 5 As shown, the electronic device 500 is in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: one or more processors 520, a storage device 510, and a bus 550 connecting different system components (including the storage device 510 and the processor 520).

[0115] Bus 550 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. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

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

[0117] The storage device 510 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 511 and / or cache memory 512. The electronic device 500 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 513 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, 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 CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 550 via one or more data medium interfaces. The storage device 510 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the embodiments of the present invention.

[0118] A program / utility 514 having a set (at least one) of program modules 515 may be stored, for example, in a storage device 510, such program modules 515 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include an implementation of a network environment. The program modules 515 generally perform the functions and / or methods of any embodiment described herein.

[0119] The electronic device 500 may also communicate with one or more external devices 560 (e.g., keyboard, pointing device, display 570, etc.), one or more devices that enable a user to interact with the electronic device 500, and / or any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output interface (I / O interface) 530. Furthermore, the electronic device 500 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 540. Figure 5 As shown, the network adapter 540 communicates with other modules of the electronic device 500 via the bus 550. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0120] The processor 520 executes various functional applications and data processing by running the programs stored in the storage device 510, such as implementing the message processing method based on the Android system provided in the embodiment of the present invention.

[0121] Embodiment 6

[0122] This embodiment provides a storage medium containing computer executable instructions. When the computer executable instructions are executed by a computer processor, they are used to execute a message processing method based on an Android system. The method includes:

[0123] Obtain a pending message, wherein the pending message is a message based on any message processing mechanism in the Android system;

[0124] According to the receiving page object identifier in the message to be processed, at least one receiving page object is determined from a page object storage pool of a key-value pair structure, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on the page object monitoring method;

[0125] With the message to be processed as the input parameter, the message forwarding function of the receiving page object is called respectively to forward the message to be processed to each receiving page object, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms.

[0126] Of course, the storage medium containing computer executable instructions provided in an embodiment of the present invention is not limited to the above method operations, and the computer executable instructions can also execute related operations in the message processing method based on the Android system provided in any embodiment of the present invention.

[0127] 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.

[0128] 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.

[0129] 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.

[0130] 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).

[0131] 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 described 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. A message processing method based on Android system, characterized in that: include: Obtain a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system; According to the received page object identifier in the to-be-processed message, at least one received page object is determined from a page object storage pool of a key-value pair structure, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on a page object monitoring method; Taking the message to be processed as an input parameter, respectively calling the message forwarding function of the receiving page object, forwarding the message to be processed to each of the receiving page objects, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms; The step of determining at least one received page object from a page object storage pool of a key-value pair structure according to the received page object identifier in the message to be processed includes: Taking the received page object identifier as a second current page object identifier of the same page class, and taking the second current page object identifier as an input parameter, calling a key information query function of the page object storage pool to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool; If so, taking the second current page object identifier as an input parameter, calling the object acquisition function of the page object storage pool to obtain the receiving page object corresponding to the second current page object identifier; The second current page object identifier is updated using the next level identifier of the key information level identifier in the received page object identifier and the second current page object identifier, and the step of returning to execute the key information query function of the page object storage pool with the second current page object identifier as an input parameter to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool, until it is determined that the page object storage pool does not store a page object with the second current page object identifier as key information.

2. The method according to claim 1, characterized in that The message to be processed is a system message based on the broadcast message mechanism in the Android system, a business message based on the broadcast message mechanism or the listener message mechanism, or a display interface update message based on the broadcast message mechanism or the listener message mechanism.

3. The method according to claim 1, characterized in that The method further comprises: Create and initialize the page object storage pool based on the key-value pair map structure; When a page object creation operation is monitored based on the page object monitoring mode, the created page object identifier is used as the first current page object identifier of the same page class; Taking the first current page object identifier as an input parameter, calling the key information query function of the page object storage pool to determine whether the page object storage pool has stored a page object with the first current page object identifier as key information; If so, the first current page object identifier is updated using the next level identifier of the key information level identifier of the creation page object identifier and the first current page object identifier, and the step of returning to execute the key information query function of the page object storage pool with the first current page object identifier as an input parameter to determine whether a page object with the first current page object identifier as key information has been stored in the page object storage pool; If not, the object storage function of the page object storage pool is called with the first current page object identifier and the created page object as input parameters, and the first current page object identifier and the created page object are respectively stored in the page object storage pool as key information and value information.

4. The method according to claim 3, characterized in that After the page object storage pool is created and initialized based on the key-value pair map structure, the following steps are also included: When a page object destruction operation is monitored based on the page object monitoring mode, the object deletion function of the page object storage pool is called with the destroyed page object identifier containing the level key information identifier of the destroyed page object as an input parameter to delete the destroyed page object from the page object storage pool.

5. The method according to claim 1 or 3, characterized in that: The next level identifier is composed of a preset character string connector and a number.

6. The method according to claim 1, characterized in that The page object monitoring method is: Taking the target callback variable as an input parameter, calling the page lifecycle callback function in the target application class object, monitoring the calling of the page object creation function and / or page object destruction function of each page object in the target application class object, so as to monitor the creation operation and destruction operation of each page object; The target callback variable is a variable of the page life cycle callback interface type, and the page creation function and the page destruction function in the page life cycle callback interface are overwritten in the target callback variable.

7. A message processing device based on Android system, characterized in that: include: A message acquisition module, used to acquire a message to be processed, wherein the message to be processed is a message based on any message processing mechanism in the Android system; A receiving page object determining module, configured to determine at least one receiving page object from a page object storage pool of a key-value pair structure according to a receiving page object identifier in the message to be processed, wherein the page object storage pool stores page objects of multiple page classes, and the same page class corresponds to multiple page objects, and the page object is an active page object monitored based on a page object monitoring method; A message forwarding module, used to take the message to be processed as an input parameter, respectively call the message forwarding function of the receiving page object, and forward the message to be processed to each of the receiving page objects, so as to realize the unified forwarding of the messages to be processed of different message processing mechanisms; The receiving page object determination module is specifically used for: Taking the received page object identifier as a second current page object identifier of the same page class, and taking the second current page object identifier as an input parameter, calling a key information query function of the page object storage pool to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool; If so, taking the second current page object identifier as an input parameter, calling the object acquisition function of the page object storage pool to obtain the receiving page object corresponding to the second current page object identifier; The second current page object identifier is updated using the next level identifier of the key information level identifier in the received page object identifier and the second current page object identifier, and the step of returning to execute the key information query function of the page object storage pool with the second current page object identifier as an input parameter to determine whether a page object with the second current page object identifier as key information is stored in the page object storage pool, until it is determined that the page object storage pool does not store a page object with the second current page object identifier as key information.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method based on the Android system as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the message processing method based on the Android system as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Processing method and device of barrage messages, terminal and storage medium

    CN109327726A

  • In-page data communication method and device, equipment and medium

    CN110633443A