Method for processing push message and electronic equipment
By writing push messages to its synchronization data file when the application is not running and obtaining messages from the file when the application is started, the problem of waking the application process in the prior art increases power consumption, and the timeliness and user experience of push messages are improved.
Patent Information
- Application Number
- CN202510054515.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-12-29
- Filing Date
- 2024-01-10
- Publication Date
- 2025-05-13
AI Technical Summary
In the prior art, in electronic devices, in order to receive push messages, it is necessary to wake up the process of the application, resulting in an increase in power consumption, reduce device battery life, and affect user experience.
The need to wake up the application process is avoided by writing the push message to its synchronization data file when the application is not running, and fetching the message from the application when it is started.
It realizes that without adding additional power consumption, synchronous push of messages to applications, ensuring the timeliness of messages and improving user experience.
Smart Images

Figure CN119996504A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202410041871.1, and the original application date is January 10, 2024. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of electronic devices, and more specifically, to a method for processing push messages and an electronic device. Background Art
[0003] With the advancement and development of technology, most applications in electronic devices provide message push functions, such as hot news recommendations in news applications, chat message reminders in chat applications, etc. These messages can be collectively referred to as push messages. Push messages play an important role in improving the activity of applications, improving the utilization rate of functional modules, improving user stickiness, and improving user retention. At present, in order for applications in electronic devices to receive push messages in a timely manner, it is necessary to ensure that the process of the application is alive. When the process of the application is not alive, the process of the application needs to be awakened first, and then the message is pushed to the application. However, the process of waking up the application consumes a lot of power. When the electronic device receives a large number of push messages and the process of the application corresponding to the push message is not alive, the corresponding processes need to be awakened one by one, which will increase the power consumption of the electronic device, thereby reducing the battery life of the electronic device, resulting in a decline in the user experience. Based on this, how to push messages synchronously without waking up the process of the application has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The present application provides a method for processing push messages and an electronic device, which can synchronize push messages to an application without waking up the application process, thereby ensuring the timeliness of the push messages and not increasing additional power consumption, thereby helping to improve the user experience.
[0005] In a first aspect, a method for processing push messages is provided, which is applied to an electronic device, and the method includes: receiving a first push message, the first push message is associated with a first application, and the first application is not running; writing the first push message into a first synchronization data file of the first application; starting the first application, and the first application obtains the first push message from the first synchronization data file.
[0006] In an embodiment of the present application, when the first application is not running, the push message can be written into the synchronization data file through the synchronization manager. The process of writing the push message does not require the participation of the application process, thereby ensuring the timeliness of the push message and does not increase additional power consumption, which helps to improve the user experience.
[0007] In addition, since the push message has been synchronized to the synchronization data file of the application, when the application is started, the application can directly obtain the push message from the synchronization data file, thereby improving the speed at which the application obtains the push message.
[0008] In combination with the first aspect, in certain implementations of the first aspect, the writing the first push message into the first synchronization data file of the first application includes: writing the first push message into the first synchronization data file through the first mapping path, wherein the first mapping path is a path for cross-process access to the first synchronization data file of the first application, the first mapping path is different from the actual path of the first synchronization data file, and the first synchronization data file is used to store push messages.
[0009] In the embodiment of the present application, the synchronization data file in the application sandbox is mapped so that the push message can be written into the synchronization data file through the mapping path of the synchronization data file.
[0010] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: receiving a second push message, the second push message is associated with the second application, and the second application is running; and sending the second push message to the second application through an inter-process communication IPC mechanism.
[0011] In the embodiment of the present application, different methods of processing push messages can be adopted according to whether the application is running, which ensures the delivery of push messages to the greatest extent and helps to improve the user experience.
[0012] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: identifying authorization information of the first application; and writing the first push message into the first synchronization data file of the first application, including: determining that the authorization information indicates that the first synchronization data file can be accessed, and writing the first push message into the first synchronization data file of the first application.
[0013] In the embodiment of the present application, a permission management mechanism is also introduced to manage the permission of cross-process access to the synchronization data files of the application, thereby avoiding malicious access and improving security.
[0014] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: detecting whether the first push message meets a preset condition; and writing the first push message into the first synchronization data file of the first application, including: determining that the preset condition is met, and writing the first push message into the first synchronization data file.
[0015] In combination with the first aspect, in certain implementations of the first aspect, the preset condition includes one or more of the following: the type of the first push message is a preset type; the scenario corresponding to the first push message is a background push scenario.
[0016] In combination with the first aspect, in some implementations of the first aspect, the preset type includes one or more of the following: a notification message type, an instant messaging IM message type, and a configuration data message type.
[0017] In combination with the first aspect, in some implementations of the first aspect, the method further includes: displaying the first push message.
[0018] The second aspect is an electronic device of an embodiment of the present application, which includes modules / units for executing the above aspects or any possible design method of the above aspects; these modules / units can be implemented by hardware, or the corresponding software can be implemented by hardware.
[0019] The third aspect is a chip of an embodiment of the present application, which is coupled to a memory in an electronic device and is used to call a computer program stored in the memory and execute the above-mentioned aspects of the embodiment of the present application and any possible design of the above-mentioned aspects of the embodiment of the present application; in the embodiment of the present application, "coupling" refers to the direct or indirect combination of two components with each other.
[0020] The fourth aspect is an electronic device of an embodiment of the present application, which includes one or more processors; one or more memories; the one or more memories store one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by the one or more processors, the above aspects or any possible implementation of the above aspects are executed.
[0021] In a fifth aspect, a computer-readable storage medium is provided, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the first aspect and any possible implementation method of the first aspect are executed.
[0022] In a sixth aspect, a computer program product is provided, which includes a computer program or instructions. When the computer program or instructions are run on a computer, the first aspect and any possible implementation method of the first aspect are executed.
[0023] In a seventh aspect, a computer program is provided, which, when executed on a computer, enables the method in the first aspect and any possible implementation thereof to be executed.
[0024] Among them, for the beneficial effects of the second to seventh aspects, please refer to the beneficial effects of the first to third aspects and will not be repeated. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0026] Figure 2 It is a software structure block diagram of the electronic device according to an embodiment of the present application.
[0027] Figure 3 It is a schematic diagram of the sandbox provided in an embodiment of the present application.
[0028] Figure 4 is a schematic flow chart of a method for processing a push message.
[0029] Figure 5 It is a schematic flowchart of the method for processing push messages provided in an embodiment of the present application.
[0030] Figure 6 It is a schematic flowchart of the method for processing push messages provided in an embodiment of the present application.
[0031] Figure 7 It is a set of GUIs provided by the embodiments of the present application. DETAILED DESCRIPTION
[0032] The terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one, two or more. The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0033] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0034] The following describes an electronic device, a user interface for such an electronic device, and an embodiment for using such an electronic device. In some embodiments, the electronic device may be a personal computer (PC), such as a laptop computer or a desktop computer. The operating system installed on the PC includes, but is not limited to, desktop operating systems such as Windows operating system, Linux operating system, MacOS operating system, and may also be a desktop operating system to be launched in the future.
[0035] For example, Figure 1 1 shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0036] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0037] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0038] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0039] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0040] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0041] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0042] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0043] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0044] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0045] Figure 2 1 is a software structure diagram of the electronic device 100 of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework and service layer, the Android runtime (Android runtime) and the system library, and the kernel layer. The application layer can include a series of application packages.
[0046] like Figure 2 As shown, the application layer may include camera, settings, third-party applications, etc. Among them, the third-party applications may include gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0047] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer may include some predefined functions.
[0048] like Figure 2 As shown, the application framework and service layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0049] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make the data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0050] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc., such as the indication information for prompting a virtual shutter key in the embodiment of the present application. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon can include a view for displaying text and a view for displaying pictures.
[0051] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0052] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0053] The push manager is used to receive push messages sent by the push server or application server. The push manager can also be called a push client or a push service.
[0054] The synchronization manager is used to identify the authorization information of the application, which is used to indicate that the synchronization data file can be accessed across processes. The synchronization data file is an application file that stores push messages. The synchronization manager is also used to map the synchronization data file according to the authorization information and manage the permissions for cross-process access to the synchronization data file. In other words, the synchronization manager can determine whether the push manager is allowed to access the synchronization data file. The push manager accessing the synchronization data file can be understood as the push manager writing data to the synchronization data file or reading data from the synchronization data file. The synchronization manager can also be called a synchronization service.
[0055] For example, application #1 has authorized the push manager to access synchronization data file #1, and application #2 has not authorized the push manager to access synchronization data file #2. When the synchronization manager receives a push message sent by the push manager to application #1, since application #1 has authorized the push manager to access synchronization data file #1, the push message can be written to synchronization data file #1 through the inter-process communication (IPC) mechanism. When the synchronization manager receives a push message sent by the push manager to application #2, since application #2 has not authorized the push manager to access synchronization data file #2, the push message will be prohibited from being written to synchronization data file #2.
[0056] It should be noted that a detailed description of the push manager and the synchronization manager can be found below and will not be elaborated here.
[0057] Android runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0058] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0059] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0060] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0061] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0062] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0063] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0064] A 2D graphics engine is a drawing engine for 2D drawings.
[0065] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0066] The hardware layer can include various types of sensors, such as Figure 1 The various types of sensors introduced in the present application include acceleration sensors, gyroscope sensors, touch sensors, etc.
[0067] It should be noted that Figure 2 The framework of the Android system is used as an example, which should not be understood as a specific limitation on the embodiments of the present application. In the embodiments of the present application, the electronic device may also be equipped with other operating systems (for example, Hongmeng operating system), and different frameworks may be used for different operating systems. It is understandable that when different frameworks are adopted, the specific names of the layers of the framework may be different.
[0068] In order to facilitate understanding of the embodiments of the present application, the following concepts may be involved in the embodiments of the present application:
[0069] Process: The running entity of an application. An application is a description of instructions, data and their organizational form, and a process is the running entity of an application.
[0070] Application files: Files owned by applications, including application installation files, application resource files, application cache files, etc. Data used and stored by applications on electronic devices are stored in a dedicated directory of an application in the form of files, key-value pairs, databases, etc. This dedicated directory can be called an application file directory. All data under this directory is stored in different file formats, and these files are called application files. Push messages of applications are stored in application files.
[0071] Sandbox: Also known as sandbox, it is a security mechanism used to provide an isolated environment for applications, which can separate different applications and protect applications from attacks by malicious applications. Each application will correspond to a user identification (UID). Electronic devices can set up sandboxes based on the UID, set applications in the sandbox, and achieve isolation between applications. In other words, each application runs in its own independent process space, and applications with different UIDs naturally form resource isolation. For each application, the system will map an exclusive application sandbox directory in the internal storage space, which is a collection of directories where application file directories and some system files (a small number of system files required for application operation) are located. The sandbox limits the minimum range of data visible to the application. In the application sandbox directory, the application can only see its own application files and a small number of system files. Therefore, the files of this application are also not visible to other applications, thereby protecting the security of the application files.
[0072] like Figure 3 As shown, application process #1 runs in sandbox #1, and application process #2 runs in sandbox #2, wherein application process #1 corresponds to application program #1, and application process #2 corresponds to application program #2. Application process #1 can directly access application files of application program #1 in sandbox #1, but cannot access application files of application program #2 in sandbox #2.
[0073] Push messages: are messages that are actively pushed to users by the operating system or application. Users can see push messages on the lock screen interface, notification bar, application interface, etc. of electronic devices. Currently, the common method for applications to send push messages to users is that the application server sends push messages to the push server, which then sends them to the user's electronic device, or the application server directly sends push messages to the user.
[0074] Combine the following Figure 4 Introduce a method for processing push messages.
[0075] Figure 4 A schematic flow chart of a method for processing a push message is shown, Figure 4 As shown, the method 400 includes:
[0076] S401, application server #1 sends push message #1 to the push server.
[0077] Correspondingly, the push server receives push message #1 sent by application server #1.
[0078] The push server may be provided by the manufacturer of the electronic device, or may be provided by the operating system provider of the electronic device, application server #1 is the server corresponding to application #1, and push message #1 is the push message sent to application #1. When the application server sends push message #1 to the push server, it may also indicate the token of the electronic device, and the tokens of different electronic devices are different, thereby achieving accurate push.
[0079] S402, the push server sends a push message #1 to the push manager.
[0080] Correspondingly, the push manager receives the push message #1 sent by the push server.
[0081] The electronic device includes a push manager, which maintains a connection with the push server, so that after receiving the push message #1 sent by the application server #1, the push server can send the push message #1 to the push manager of the electronic device corresponding to the token according to the token. The push manager can also be called a push client, that is, a client for receiving push messages sent by the push server.
[0082] S403: The push manager detects whether the process of application #1 is alive.
[0083] The push manager may detect whether the process of application #1 is alive. When it is determined that the process of application #1 is alive, the process goes to S404. When it is determined that the process of application #1 is not alive, the process goes to S405.
[0084] It should be noted that the push manager detecting whether the process of application #1 is alive can also be understood as the push manager detecting whether application #1 is running. When application #1 is running, the process of application #1 is alive, and when application #1 is not running, the process of application #1 is not alive. The process of application #1 can be the main process of application #1.
[0085] It should also be noted that the running of application #1 may include foreground running and background running.
[0086] S404: The push manager sends a push message #1 to application #1.
[0087] Correspondingly, application #1 receives push message #1 sent by the push manager.
[0088] The push manager determines that the process of application #1 is alive and can send push message #1 to application #1 through a mechanism such as cross-process communication.
[0089] S405, the push manager wakes up the process of application #1 and then sends push message #1 to application #1.
[0090] Since the push manager determines that the process of application #1 is not alive and sending push message #1 to application #1 requires relying on a cross-process communication mechanism, it is necessary to wake up the process of application #1 and then send push message #1 to application #1 through a cross-process communication mechanism.
[0091] In the above Figure 4 In the method 400 shown, when the process of application #1 is not alive, the push manager needs to wake up the process of application #1 first, and then send push message #1 to application #1. However, the power consumption of the push manager to wake up the process of application #1 is relatively large. If the push server or application server sends multiple push messages to the push manager, and the processes of the applications corresponding to the multiple push messages are not alive, the corresponding application processes need to be woken up one by one, which will consume greater power consumption, reduce the battery life of the electronic device, and also lead to a decline in the user experience.
[0092] In summary, how to quickly push messages to applications has become a technical problem that needs to be solved urgently. Based on this, the embodiment of the present application provides a method for processing push messages. According to the method for processing push messages provided in the embodiment of the present application, even if the application process is not alive, the push message can be quickly synchronized to the application without waking up the application, which not only ensures the timely delivery of the push message, but also does not increase additional power consumption. Figure 5 Give a detailed introduction.
[0093] Figure 5 A schematic flow chart of a method for processing a push message provided by an embodiment of the present application is shown, the method being executed by an application server, a push server and an electronic device, wherein the electronic device comprises a push manager, a synchronization manager and an application #1, such as Figure 5 As shown, the 500 includes:
[0094] S501, the synchronization manager identifies the authorization information of application #1.
[0095] Specifically, application #1 can store authorization information in a specific description file, and the authorization information is used to indicate that the synchronization data file can be authorized to the push manager. The synchronization data file is used to store push messages, and the synchronization data file is an application file stored in the sandbox corresponding to application #1. The synchronization data file can be authorized to the push manager, which can be understood as the push manager can access the synchronization data file across processes, that is, write data to the synchronization data file and / or read data in the synchronization data file. Therefore, when the electronic device successfully installs application #1, the synchronization manager can identify the authorization information of application #1, or when the electronic device successfully installs application #1 and runs application #1 for the first time, the synchronization manager can identify the authorization information of application #1.
[0096] In some embodiments, the authorization information is also used to indicate operation permissions.
[0097] For example, if the authorization information indicates that the push manager can be granted write permission, the push manager can write push messages to the synchronization data file through the synchronization manager. However, since the push manager is not granted read permission, the push manager cannot read push messages in the synchronization data file through the synchronization manager.
[0098] For another example, the authorization information indicates that the push manager can be granted write permission and read permission, so the push manager can write push messages into the synchronization data file through the synchronization manager and can also read push messages in the synchronization data file through the synchronization manager.
[0099] S502: The synchronization manager maps the synchronization data file according to the authorization information of the application #1.
[0100] Specifically, the synchronization manager may determine, based on the authorization information, that the synchronization data file of application #1 can be authorized to the push manager, and the synchronization manager may map the synchronization data file to manage cross-process access permissions to the synchronization data file.
[0101] It should be noted that the actual path of the synchronization data file of application #1 corresponds to a mapping path #1, and the mapping path #1 is a path for cross-process access to the synchronization data file of application #1.
[0102] For example, the actual path of the synchronized data file of application #1 is: / data / app / <UID#1> / <bundleName#1> / file.db, where UID#1 is the UID corresponding to application#1, bundleName#1 is the package name corresponding to application#1, and the mapping path of the synchronization data file of application#1 is dataproxy: / / <bundleName#1> / file.db.
[0103] It is understandable that, since the synchronization manager maps the synchronization data file of application #1, the push manager can write the push message into the synchronization data file of application #1 through the mapping path #1 and after authorization by the synchronization manager.
[0104] In the embodiment of the present application, the mapping path of the synchronization data file of the application can be determined in a variety of ways, and the embodiment of the present application does not specifically limit this. The following is an exemplary introduction to several possible implementation methods.
[0105] In a first possible implementation, the mapping path is pre-set. The operating system provider provides a preset rule, and the application developer can declare the mapping path of the synchronization data file according to the preset rule, so that after the application is successfully installed, the synchronization manager can determine the mapping path of the synchronization data file of the application.
[0106] It is understandable that in this manner, the push manager can also determine the mapping path of the synchronization data file of the application.
[0107] It is also understandable that the mapping paths corresponding to different applications are different.
[0108] In a second possible implementation, the mapping path is generated by the synchronization manager. In this implementation, the synchronization manager can generate different mapping paths for synchronization data files of different applications.
[0109] For example, the synchronization manager can generate different mapping paths based on the package names of different applications.
[0110] For another example, the synchronization manager may generate different mapping paths according to the UIDs of different applications.
[0111] In this way, the synchronization manager can also synchronize the generated mapping path to the push manager.
[0112] In a third possible implementation, the application server can send the mapping path synchronously when sending a push message to the push server, and then the push server forwards the push message and the mapping path to the push manager. In other words, in this method, the application server specifies the push manager to write the push message to the synchronization data file according to the mapping path sent by it.
[0113] In a fourth possible implementation, the push server may also send a mapping path when forwarding a push message. It should be noted that the fourth possible implementation is different from the third possible implementation in that the push server manages the mapping path of each application. When the push server receives a push message sent by an application, it may determine the application corresponding to the push message, and then send the mapping path corresponding to the application when forwarding the push message.
[0114] In a fifth possible implementation, the application server may send the mapping path synchronously when sending a push message to the push manager.
[0115] It should be noted that, in the above, the mapping path of the synchronization data file and the actual path of the synchronization data file are used as an example, but the embodiments of the present application do not specifically limit this. For example, in other embodiments, the identifier of the application (such as UID, package name, etc.) can also be associated with the actual path of the synchronization data file, that is, the mapping relationship between the identifier of the application and the synchronization data file can be established according to any of the above possible implementation methods, and then the actual path of the synchronization data file can be determined by the identifier of the application.
[0116] S503, application server #1 sends push message #1 to the push server.
[0117] Correspondingly, the push server receives push message #1 sent by application server #1.
[0118] S504, the push server sends a push message #1 to the push manager.
[0119] Correspondingly, the push manager receives the push message #1 sent by the push server.
[0120] It should be understood that the description of S503 and S504 can refer to the description of S301 and S302 above, and for the sake of brevity, they are not repeated here.
[0121] It should be noted that the embodiment of the present application is only an example of an application server sending a push message to a push server, and then the push server sending a push manager, but this is not specifically limited. In other embodiments, the application server can be connected to the push manager, so that the application server can directly send a push message to the push manager.
[0122] S505: The push manager writes a push message #1 to the synchronization data file through the synchronization manager.
[0123] Specifically, after receiving push message #1, the push manager can determine that push message #1 is a push message corresponding to application #1, and then the push manager can write push message #1 to the synchronization data file according to mapping path #1 through the interface of the synchronization manager. In the above process, the synchronization manager will verify whether the push manager is allowed to write data to the synchronization data file. After the verification is passed, push message #1 will be written to the synchronization data file of application #1 according to mapping path #1.
[0124] It can be understood that in the above process of writing push message #1 to the synchronization data file of application #1, it is written through the mapped path, and the actual path (or real path) of the synchronization data file of application #1 will not be exposed, and the synchronization manager will also verify the permissions of the process that writes data to the synchronization data file, which can fully ensure that the synchronization data file of application #1 will not be maliciously accessed.
[0125] In the embodiment of the present application, there is no specific limitation on the identifier of application #1. For example, the identifier of application #1 may be the package name of application #1.
[0126] As another example, the identifier of application #1 may be the UID of application #1.
[0127] For another example, a new parameter may be defined to identify different applications.
[0128] In other embodiments, when the push manager inputs data through the interface of the synchronization manager, it is not necessary to input mapping path #1. Instead, the synchronization manager determines mapping path #1 based on the identifier of application #1, and then the synchronization manager verifies whether the push manager is allowed to write data to the synchronization data file #1. After the verification is passed, the push message #1 will be written to the synchronization data file of application #1 according to mapping path #1.
[0129] For example, the unified format of the application's mapping path is: dataproxy: / / <bundlename> / file.db, after the synchronization manager determines the package name of the application #1, it can determine the mapping path #1 corresponding to the application #1 according to the unified format.
[0130] In the embodiment of the present application, the synchronization data file in the application sandbox is mapped so that the push manager can write the push message into the synchronization data file through the mapping path of the synchronization data file. The process of writing the push message does not require the participation of the application process, so that even if the application process is not alive, the push manager can synchronize the push message to the application, ensuring the timeliness of the push message without increasing additional power consumption, which helps to improve the user experience. At the same time, a synchronization manager is introduced, through which the permissions for cross-process access to the synchronization data file of the application can be managed, avoiding malicious access and improving security.
[0131] Optionally, in some embodiments, Figure 5 As shown, the method 500 further includes:
[0132] S506: The push manager sends a push message #1 to the notification manager.
[0133] Correspondingly, the notification manager receives the push message #1 sent by the push manager.
[0134] After receiving push message #1, the notification manager can display the push message #1. The present application does not specifically limit the form of displaying push message #1, for example, it can appear in the top status bar of the system in the form of a chart or scroll bar text. For another example, it can also appear on the screen in the form of a dialog window.
[0135] Optionally, in some embodiments, Figure 5 As shown, before the push manager executes S505, the method 500 further includes:
[0136] S507: The push manager determines whether the push message #1 meets a preset condition.
[0137] Before the push manager writes push message #1 to the synchronization data file through the synchronization manager, it can first determine whether the push message #1 meets the preset conditions. When it is determined that the preset conditions are met, the push message #1 can be written to the synchronization data file through the synchronization manager, that is, S505 is executed. When it is determined that the preset conditions are not met, the synchronization process is terminated.
[0138] In some embodiments, the preset condition is that the type of push message #1 is a preset type.
[0139] The push manager may execute S505 when determining that the type of the push message #1 is a preset type.
[0140] Push messages can be divided into different types, for example, instant messaging (IM) message type, news information message type, operation and sales message type, personalized recommendation message type, system notification message type, notification message type, configuration data message type, etc. One or more types can be preset. When the push message is of one or more preset types, the push manager can execute S505.
[0141] Exemplarily, the preset type may be a notification message type.
[0142] For example, application #1 is a social application, and the push manager determines that the type of push message #1 is a notification message type, and the push message #1 is used to remind the user that the login has expired. The push manager can write push information #1 into the synchronization data file of the social application through mapping path #1.
[0143] Exemplarily, the preset type may be an IM message type.
[0144] For example, application #1 is a social application. When the push manager determines that the type of push message #1 is an IM message type, the push manager can write push information #1 into the synchronization data file of the social application through mapping path #1, so that when the social application is started, the social application can quickly obtain the IM message directly from the synchronization data file, thereby improving the speed of obtaining push messages.
[0145] Exemplarily, push message #1 is a configuration data message type.
[0146] If the push manager determines that the type of push message #1 is a configuration data message type, the push manager can write push information #1 into the synchronization data file of the application corresponding to push information #1 through mapping path #1, so that when the application is started, the application can directly obtain push information #1 from the synchronization data file to quickly update the configuration data.
[0147] In some embodiments, the preset condition is that the scenario for pushing message #1 is a background push scenario.
[0148] When sending a push message, the application server can specify whether the push message is pushed in the foreground or in the background. Foreground push can be understood as push to the application when the application is running in the foreground, and background push can be understood as push to the application when the application is running in the background or when the application is not running. Therefore, it can be preset that when the scenario corresponding to the push message is background push, the push manager can execute S505. Push messages pushed to the application in the background can be understood as push messages that need to be processed by the application itself and do not need to be displayed to the user. For example, push messages for updating the interface layout and push messages for updating the application configuration. In some embodiments, the preset condition is that the process of application #1 associated with push message #1 is not alive.
[0149] The push manager may determine that when it is determined that the process of application #1 associated with the push message #1 is not alive, S505 is executed. On the contrary, when it is determined that the process of application #1 is alive, the push manager may execute S505 according to Figure 4 The method shown sends push message #1 to application #1 through a mechanism such as cross-process communication.
[0150] It should be noted that Figure 5 The cross-process access synchronization data file in the method shown is Figure 4 The cross-process communication mechanism in the method shown is different. The cross-process communication mechanism means that the sending process copies data to the kernel space through a system call, and then the kernel copies the data in the kernel space to the application file of the receiving process through a system call. Cross-process access to synchronous data files means directly writing data to the synchronous data file through a mapping path, and in the process of writing data, the receiving process does not need to participate.
[0151] Alternatively, in some other embodiments, the synchronization manager may determine whether the push message #1 satisfies a preset condition.
[0152] In these embodiments, the synchronization manager can determine whether push message #1 meets the preset conditions when verifying the permissions of the push manager. When it is determined that push message #1 meets the preset conditions, push message #1 will be written into the synchronization data file of application #1 according to mapping path #1.
[0153] In some embodiments, when application #1 is started in response to a user operation, application #1 may obtain push message #1 from the synchronization data file.
[0154] In the embodiment of the present application, since the push message has been synchronized to the synchronization data file of the application, when the application is started, the application can directly obtain the push message from the synchronization data file, thereby improving the speed at which the application obtains the push message.
[0155] In the above embodiment, the push message synchronized by the method provided in the embodiment of the present application may be a push message that does not need to be processed immediately by the application. Figure 4 The method shown wakes up the application process and then sends it to the application through the IPC mechanism, or wakes up the application process after synchronously pushing the message through the method provided in the embodiment of the present application.
[0156] For example, a push message is a voice over internet protocol (VoIP) message that needs to be processed immediately by an application.
[0157] For another example, the push message is a positioning message, which is a message that needs to be processed immediately by the application.
[0158] The above text introduces the method for processing push messages provided by the embodiment of the present application with each module as the main body. The division of the modules in the above text is only a logical function division, and there may be other division methods in actual implementation. For example, in other embodiments, the push manager and the synchronization manager can be combined into a new module, and the new module is used to indicate the operations performed by the push manager and the synchronization manager in the above text. The following text introduces the method for processing push messages provided by the embodiment of the present application with the electronic device as the main body.
[0159] Figure 6 A schematic flow chart of a method for processing a push message provided in an embodiment of the present application is shown. Figure 6 As shown, the method 600 includes:
[0160] S601: Receive a first push message.
[0161] In some embodiments, the electronic device may receive a first push message sent by a push server, where the push server may be provided by a manufacturer of the electronic device, or by an operating system provider of the electronic device, or may be a third-party push server.
[0162] In some embodiments, the electronic device may receive a first push message sent by an application server.
[0163] The first push message is associated with the first application, that is, the first push message is a push message of the first application, and the first application is not running, that is, the process of the first application is not alive.
[0164] S602: Write the first push message into a first synchronization data file of the first application.
[0165] After receiving the first push message, the electronic device may write the first push message into the synchronization data file of the first application through the synchronization manager.
[0166] S603: Start a first application program, and the first application program obtains a first push message from a first synchronization data file.
[0167] After the first push message is synchronized to the first synchronization data file of the first application, when the first application is started, the first application can obtain the first push message from the first synchronization data file.
[0168] In an embodiment of the present application, when the first application is not running, the push message can be written into the synchronization data file through the synchronization manager. The process of writing the push message does not require the participation of the application process, thereby ensuring the timeliness of the push message and does not increase additional power consumption, which helps to improve the user experience.
[0169] In addition, since the push message has been synchronized to the synchronization data file of the application, when the application is started, the application can directly obtain the push message from the synchronization data file, thereby improving the speed at which the application obtains the push message.
[0170] In some embodiments, S603 specifically includes: writing the first push message into the first synchronization data file through the first mapping path, wherein the first mapping path is a path for accessing the first synchronization data file of the first application, the first mapping path is different from the actual path of the first synchronization data file, and the first synchronization data file is used to store push messages.
[0171] For example, the actual path of the first synchronization data file is: / data / app / <UID#1> / <bundleName#1> / file.db, where UID#1 is the UID corresponding to the first application, bundleName#1 is the package name of the first application, and the first mapping path is dataproxy: / / <bundleName#1> / file.db, it can be seen that the first mapping path is different from the actual path of the first synchronization data file.
[0172] In some embodiments, the first mapping path is pre-set.
[0173] In some embodiments, the first mapping path is generated by a synchronization manager of the electronic device.
[0174] In some embodiments, when the application server sends the first push message to the push server, it can simultaneously send the first mapping path, and then the push server forwards the first push message and the first mapping path to the electronic device.
[0175] In some embodiments, the push server may also send the first mapping path when forwarding the first push message. It should be noted that in this manner, the push server manages the mapping path of each application.
[0176] In some embodiments, when the application server sends the first push message to the push server, it can simultaneously send the first mapping path, and then the push server forwards the first push message and the first mapping path to the electronic device.
[0177] In some embodiments, when the application server sends the first push message to the electronic device, it can simultaneously send the first mapping path.
[0178] In some embodiments, the method 600 further includes:
[0179] receiving a second push message, the second push message being associated with a second application, the second application being running;
[0180] The second push message is sent to the second application through an inter-process communication (IPC) mechanism.
[0181] When the electronic device receives the second push message of the running second application, the second push message can be sent to the second application through the IPC mechanism.
[0182] In the embodiment of the present application, different methods for processing push messages can be adopted according to whether the application is running, and multiple paths for synchronous push messages are provided, which ensures the delivery of push messages to the greatest extent and helps to improve the user experience.
[0183] In some embodiments, before the electronic device executes S603, the method 600 further includes: identifying authorization information of the first application.
[0184] S603 specifically includes: determining that the authorization information indicates that the first synchronization data file can be accessed, and writing the first push message into the first synchronization data file.
[0185] Accessing the first synchronization data file may include writing data to the first synchronization data file, and may also include reading data in the first synchronization data file.
[0186] The first application stores authorization information. When the electronic device writes the first push message to the first synchronization data file, it needs to first verify whether it has the authority to write the first push message to the first synchronization data file. When it is determined that it has the authority, the first push message can be written.
[0187] In the embodiment of the present application, a permission management mechanism is also introduced to manage the permission of cross-process access to the synchronization data files of the application, thereby avoiding malicious access and improving security.
[0188] In some embodiments, before the electronic device executes S603, the method 600 further includes: detecting whether a preset condition is met.
[0189] S603 specifically includes: determining that a preset condition is met, and writing the first push message into a first synchronization data file.
[0190] When the electronic device writes the first push message to the first synchronization data file, it can first detect whether the first push message meets the preset conditions through the push manager or the synchronization manager, and when the preset conditions are met, write the first push message to the first synchronization data file. In other words, not all push messages can be written to the synchronization data file according to the method for processing push messages provided in the embodiment of the present application.
[0191] In some embodiments, the preset conditions include one or more of the following: the type of the first push message is a preset type; the scenario corresponding to the first push message is a background push scenario.
[0192] In some embodiments, the preset type includes one or more of the following: a notification message type, an instant messaging IM message type, and a configuration data message type.
[0193] In some embodiments, the method 600 further includes: displaying the first push message.
[0194] Figure 7 A set of graphical user interfaces (GUIs) provided by an embodiment of the present application is shown.
[0195] like Figure 7 As shown in (a), the mobile phone receives a push message from "Huawei Music" to prompt the user to play newly added songs every day. The mobile phone can display a notification bar 702 on the desktop 701, and the notification bar 702 displays "Daily New Songs".
[0196] In some embodiments, launching the first application may be: detecting an operation of a user on the first push message, and launching the first application in response to the operation of the user on the first push message.
[0197] For example, Figure 7 As shown in (a) and (b) in FIG. 1 , the mobile phone detects that the user clicks on the notification bar 702. In response to the operation, the mobile phone displays an interface 703, which is the interface of "Huawei Music". The interface 703 may include information about newly added songs. It can be understood that the information about newly added songs on the interface 703 is obtained by "Huawei Music" from its synchronization data file. Compared with the existing application program obtaining push messages from the push manager through cross-process communication, the speed of obtaining push messages from the synchronization data file will be faster.
[0198] In the embodiment of the present application, since the push message has been synchronized to the synchronization data file of the application, when the application is started, the application can directly obtain the push message from the synchronization data file, thereby improving the speed at which the application obtains the push message.
[0199] The embodiment of the present application provides a computer program product, when the computer program product is run on an electronic device, the electronic device executes the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above method-related embodiments, and will not be repeated here.
[0200] The embodiment of the present application provides a readable storage medium, the readable storage medium contains instructions, when the instructions are executed in an electronic device, the electronic device executes the technical solution of the above embodiment. The implementation principle and technical effect are similar, and will not be repeated here.
[0201] The embodiment of the present application provides a chip, the chip is used to execute instructions, when the chip is running, the technical solution in the above embodiment is executed. The implementation principle and technical effect are similar, and will not be repeated here.
[0202] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0203] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0204] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0205] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0206] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0207] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0208] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiment of the present application, which should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application should be based on the protection scope of the claims.< / bundlename>
Claims
1. A method for processing a push message, characterized in that: The method is applied to an electronic device, and the method comprises: receiving a first push message, the first push message being associated with a first application, the first application being not running; Writing the first push message into a first synchronization data file of the first application; The first application is started, and the first application obtains the first push message from the first synchronization data file.
2. The method according to claim 1, characterized in that The step of writing the first push message into a first synchronization data file of the first application program includes: The first push message is written into the first synchronization data file through a first mapping path, wherein the first mapping path is a path for accessing the first synchronization data file of the first application, the first mapping path is different from an actual path of the first synchronization data file, and the first synchronization data file is used to store push messages.
3. The method according to claim 2, characterized in that The first mapping path is preset, generated by a synchronization manager of the electronic device, or sent to the electronic device by a server.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: receiving a second push message, wherein the second push message is associated with a second application, and the second application is running; The second push message is sent to the second application via an inter-process communication (IPC) mechanism.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: identifying authorization information for the first application; The step of writing the first push message into a first synchronization data file of the first application program includes: It is determined that the authorization information indicates that the first synchronization data file can be accessed, and the first push message is written into the first synchronization data file of the first application.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Detecting whether the first push message meets a preset condition; The step of writing the first push message into a first synchronization data file of the first application program includes: Determine that the preset condition is met, and write the first push message into the first synchronization data file.
7. The method according to claim 6, characterized in that The preset conditions include one or more of the following: The type of the first push message is a preset type; The scenario corresponding to the first push message is a background push scenario.
8. The method according to claim 7, characterized in that The preset type includes one or more of the following: a notification message type, an instant messaging IM message type, and a configuration data message type.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: The first push message is displayed.
10. An electronic device, characterized in that: The method comprises one or more processors; one or more memories; the one or more memories store one or more computer programs, the one or more computer programs include instructions, and when the instructions are executed by the one or more processors, the method according to any one of claims 1 to 9 is executed.
11. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the method according to any one of claims 1 to 9 is executed.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the method according to any one of claims 1 to 9 is executed.
13. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Data access method and device, terminal and storage medium
CN110851823A
File access method, communication system and electronic equipment
CN115114235A
File synchronization method for improving synchronization security
CN115277680A
Push message processing method and device, electronic equipment and storage medium
CN115529347A