CN111245930A - Cross-platform message pushing method and device, computer equipment and storage medium - Google Patents

Cross-platform message pushing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111245930A
CN111245930A CN202010023605.8A CN202010023605A CN111245930A CN 111245930 A CN111245930 A CN 111245930A CN 202010023605 A CN202010023605 A CN 202010023605A CN 111245930 A CN111245930 A CN 111245930A
Authority
CN
China
Prior art keywords
interface
notification information
message
android
current notification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010023605.8A
Other languages
Chinese (zh)
Inventor
张�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202010023605.8A priority Critical patent/CN111245930A/en
Publication of CN111245930A publication Critical patent/CN111245930A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4633Interconnection of networks using encapsulation techniques, e.g. tunneling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Abstract

The invention discloses a cross-platform message pushing method, a cross-platform message pushing device, computer equipment and a storage medium. The method comprises the steps of receiving first interface configuration information, and configuring a first interface according to the first interface configuration information; receiving second interface configuration information; converting the C header file according to a predefined local method to be added to the dynamic link library project to obtain a second interface; judging whether the first interface receives current notification information pushed by a background server; if the first interface receives the current notification information pushed by the background server, the current notification information is sent to the iOS end through the first interface, and/or the current notification information in the first interface is read through the second interface to be sent to the Android end. The method realizes cross-platform message pushing through the first interface and the second interface in the server, and the same message pushing platform is integrated by the first interface and the second interface, thereby reducing development and maintenance cost.

Description

Cross-platform message pushing method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a cross-platform message pushing method and apparatus, a computer device, and a storage medium.
Background
Currently, a message server develops a set of message push systems for Android (an Android operating system provided by google corporation) and iOS (an operating system provided by apple corporation) platforms respectively, so that when a background sends information to the Android and iOS platforms, the Android and iOS platforms push the message respectively, which results in a complex message push system structure and increases development cost.
Disclosure of Invention
The embodiment of the invention provides a cross-platform message pushing method, a cross-platform message pushing device, computer equipment and a storage medium, and aims to solve the problems that when a message server sends information to an Android platform and an iOS platform in the prior art, respective message pushing systems of the Android platform and the iOS platform push messages respectively, so that the message pushing system is complex in structure and high in development cost.
In a first aspect, an embodiment of the present invention provides a cross-platform message pushing method, which includes:
receiving first interface configuration information, and configuring a first interface for receiving and storing notification information sent by a message server according to the first interface configuration information;
receiving second interface configuration information, converting a C header file according to a predefined local method to add the second interface configuration information to a dynamic link library project, and obtaining a second interface for calling notification information in the first interface to push the notification information to an Android end;
judging whether the first interface receives current notification information pushed by a background server; and
if the first interface receives the current notification information pushed by the background server, the current notification information is sent to an iOS end through the first interface, and/or the current notification information in the first interface is read through the second interface to be sent to an Android end.
In a second aspect, an embodiment of the present invention provides a cross-platform message pushing apparatus, which includes:
the first interface configuration unit is used for receiving first interface configuration information and configuring a first interface for receiving and storing notification information sent by the message server according to the first interface configuration information;
the second interface generation unit is used for receiving second interface configuration information, converting a C header file according to a predefined local method to add the second interface to the dynamic link library engineering, and obtaining a second interface used for calling the notification information in the first interface to push the notification information to the Android terminal;
the information receiving and judging unit is used for judging whether the first interface receives the current notification information pushed by the background server; and
and the information cross-platform pushing unit is used for sending the current notification information to an iOS (internet operating system) end through the first interface and/or reading the current notification information in the first interface through the second interface to send the current notification information to an Android end if the first interface receives the current notification information pushed by the background server.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the cross-platform message pushing method described in the first aspect.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the cross-platform message pushing method according to the first aspect.
The embodiment of the invention provides a cross-platform message pushing method and device, computer equipment and a storage medium. The method realizes cross-platform message pushing through the first interface and the second interface in the server, and the same message pushing platform is integrated by the first interface and the second interface, thereby reducing development and maintenance cost.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a cross-platform message pushing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a cross-platform message pushing method according to an embodiment of the present invention;
fig. 3 is a sub-flow diagram of a cross-platform message pushing method according to an embodiment of the present invention;
fig. 4 is another sub-flow diagram of a cross-platform message pushing method according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating message delivery in a cross-platform message pushing method according to an embodiment of the present invention;
fig. 6 is another sub-flow diagram of a cross-platform message pushing method according to an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a cross-platform message pushing apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic block diagram of a sub-unit of a cross-platform message pushing apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic block diagram of another sub-unit of a cross-platform message pushing apparatus according to an embodiment of the present invention;
FIG. 10 is a schematic block diagram of another sub-unit of a cross-platform message pushing apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a cross-platform message pushing method according to an embodiment of the present invention; fig. 2 is a schematic flowchart of a cross-platform message pushing method according to an embodiment of the present invention, where the cross-platform message pushing method is applied to a server and is executed by application software installed in the server.
As shown in fig. 2, the method includes steps S110 to S140.
S110, receiving first interface configuration information, and configuring a first interface for receiving and storing notification information sent by a message server according to the first interface configuration information.
In this embodiment, the message server (which may be understood as a message push system, and may also be referred to as a server for short) may serve as a message relay station, and receive the notification information sent by the backend server. In order to realize that the message transfer station of the message server can simultaneously push the notification information to the Android end and the iOS end when receiving the notification information sent by the background server, a middle layer interface (the middle layer interface is denoted as a first interface) capable of receiving, reading, storing and deleting the information needs to be configured in the message server, and the first interface is configured through C + + language during specific implementation.
In one embodiment, as shown in fig. 3, step S110 includes:
s111, creating a message adding interface according to a message interface function in the first interface configuration information;
s112, establishing a message updating interface according to a message updating function in the first interface configuration information;
s113, creating a message deleting interface according to a message deleting function in the first interface configuration information;
s114, packaging the message adding interface, the message updating interface and the message deleting interface to obtain a first interface.
In this embodiment, the created message adding interface is mainly used for:
11) adding general messages, inserting new messages into a general data table in batches, and realizing through an AddMessageAll () function;
12) adding personal messages: inserting new messages into the user data table according to the user id is realized through an addmessage (interuserid) function.
The message update interface is mainly used for:
21) dividing into batch update messages, and realizing through an UpdateMessaageAll () function;
22) an update message, the update message is realized by setting the state of the message as read or unread through an updatemessage (messageid) function.
The message deletion interface is mainly used for:
31) batch deletion is realized through a DeleteMessaageAll () function;
32) a delete is performed by a deletemessage (messageid) function.
Through the 3 types of functions provided by C + +, a first interface capable of receiving, reading, storing and deleting messages can be configured. After the configuration of the first interface is completed, whether the current notification information sent by the background server is received or not can be detected, and therefore the current notification information is uniformly distributed to the Android end and the iOS end.
And S120, receiving second interface configuration information, converting a C header file according to a predefined local method to add the second interface to a dynamic link library project, and obtaining a second interface for calling the notification information in the first interface to push the notification information to an Android end.
In this embodiment, a layer of interface is specifically encapsulated by using a JNI technology (JNI is called Java native interface, which means Java native interface) for the Android client to call, that is, a second interface which communicates with the first interface and can call the notification information in the first interface is configured in the message server to push the notification information to the Android client.
Wherein the native method is native method in Java. The native method is an interface for calling non-java code by java, namely the native method is a java method: the method is implemented by a non-java language, such as C. This feature is not unique to java, and many other programming languages have this mechanism, such as in C + +, which can tell the C + + compiler with an extern "C" to call a C function.
In one embodiment, as shown in fig. 4, step S120 includes:
s121, creating a Java class and defining a local method in the Java class; wherein the local method is for a first interface;
s122, generating a C header file corresponding to the local method through a javah instruction;
s123, creating a dynamic link library project, and adding the C-header file to the dynamic link library project to generate a dynamic link library file;
and S124, packaging the dynamic link library file to obtain the second interface.
In this embodiment, a Java class is created first, and a local method in the Java class is defined; in specific implementation, the method modified by the native keyword is a local method in the Java class.
Then, entering a directory where the local method is located in a DOS window in the message server, then executing a javahcom.test.TestNative command, and after the execution is finished, generating a header file with a suffix name h in the current directory, such as com _ test _ TestNative.h, wherein the header file is named according to a package name and a class name.
Then, a Dynamic link library project (i.e., DLL project, or Win32Dynamic-LinkLibrary project) is created, the generated C header file is added to the DLL project, and then a source file is created to refer to the header file and implement the function of the local function in the header file.
And finally, packaging the dynamic link library file to obtain a second interface, wherein the second interface, namely a JNI interface, calls the dynamic link library file to read the notification information in the first interface.
S130, judging whether the first interface receives the current notification information pushed by the background server.
In this embodiment, after the configuration of the first interface and the second interface is completed, whether the current notification information pushed by the background server is received is detected through a message update interface in the first interface. The detection is carried out through the first interface in a unified mode, and the current notification information sent to the Android terminal and the iOS terminal is conveniently received and distributed in a unified mode.
S140, if the first interface receives the current notification information pushed by the background server, the current notification information is sent to the iOS end through the first interface, and/or the current notification information in the first interface is read through the second interface to be sent to the Android end.
In this embodiment, please refer to the schematic diagram of message delivery shown in fig. 5, that is, each time the background server pushes the current notification information, the current notification information is first read by the first interface in the message server. The current notification information is pushed to the Android terminal and the iOS terminal at the same time, then the Android/IOS client terminal is notified that a new message exists and is displayed in a status bar, at the moment, the current notification information needs to be sent to the iOS terminal through the first interface, and/or the current notification information in the first interface is read through the second interface to be sent to the Android terminal. Because the same set of message pushing platform is integrated by the first interface and the second interface, development and maintenance cost is reduced, and cross-platform pushing of messages is realized.
In one embodiment, as shown in fig. 6, step S140 includes:
s141, analyzing the current notification information to obtain a message identification bit value in the current notification information;
s142, if the message identification bit takes the value of Android, sending the current notification information from the first interface to the second interface, and sending the current notification information to corresponding Android terminals in an Android terminal equipment list by the second interface according to a stored Android terminal equipment list;
s143, if the message identification bit takes the value of iOS, the first interface sends the current notification information to each iOS end corresponding to the iOS end equipment list according to the stored iOS end equipment list;
and S144, if the message identification bit takes the value of Android & iOS, sending the current notification information to the second interface through the first interface, sending the current notification information to each Android end corresponding to the Android end equipment list through the second interface according to the stored Android end equipment list, and sending the current notification information to each iOS end corresponding to the iOS end equipment list through the first interface according to the stored iOS end equipment list.
In this embodiment, in order to determine the push object of each notification message, the message server needs to analyze the push object to obtain the value of the message identifier in the current notification message. For example, if the value of the message identification bit is Android, the message identification bit indicates that the notification message needs to be sent to an Android terminal; if the message identification bit takes the value of iOS, the notification message is sent to the iOS terminal; and if the value of the message identification bit is Android & iOS, the notification message is sent to the iOS terminal and the Android terminal at the same time.
In the intermediate layer of the first interface, an Android end device list and an iOS end device list are stored in advance, unique device identification codes (such as mobile phone serial numbers (IMEI codes)) of devices in each list are known, the Android end device list can be used for establishing contact with a corresponding Android end and pushing messages, and the iOS end device list can be used for establishing contact with a corresponding iOS end and pushing messages.
By means of the value of the message identification bit, messages can be pushed to the Android terminal and the iOS terminal at the same time or messages can be pushed to a terminal corresponding to one system of the Android terminal and the iOS terminal.
In an embodiment, before step S141, the method further includes:
receiving a heartbeat request sent by an Android terminal and/or an iOS terminal;
acquiring a unique equipment identification code corresponding to an Android terminal in each heartbeat request to construct an Android terminal equipment list;
and acquiring the unique equipment identification code corresponding to the iOS end in each heartbeat request to construct an iOS end equipment list.
In this embodiment, in order to accurately obtain the Android device list and the iOS device list, each terminal (e.g., the Android device or the iOS device) needs to first send a heartbeat request to the message server, which indicates that the terminal is requested to be kept online and that the terminal is simultaneously uploaded with the heartbeat request, and the heartbeat request is transmitted to the unique device identifier (e.g., a serial number of the smart phone). Specifically, a unique device identification code corresponding to an Android terminal in each heartbeat request is obtained to construct an Android terminal device list; and acquiring the unique equipment identification code corresponding to the iOS end in each heartbeat request to construct an iOS end equipment list. After receiving the heartbeat request of each terminal, the message server can clearly know which terminals are in the online state and add the terminal to the corresponding equipment list. By the method, the corresponding terminals in the Android end device list or the iOS end device list stored in the message server are ensured to be in the online state, and the current notification information pushed by the message server can be successfully received.
In an embodiment, after step S120, the method further includes:
if the first interface does not receive the current notification information pushed by the message server, judging whether the size of the residual space of the cache space corresponding to the first interface is smaller than a preset data space threshold value;
if the size of the remaining space of the cache space corresponding to the first interface is smaller than the data space threshold, migrating the historical data of the cache space corresponding to the first interface to a standby server;
and sending an information acquisition request to the background server.
In this embodiment, if the first interface does not receive the current notification information pushed by the message server, one of the reasons is that the cache space corresponding to the first interface has no remaining space to store the current notification information. At this time, in order to further determine whether the current notification information is stored in the cache space without any remaining space, it may be determined whether the size of the remaining space of the cache space corresponding to the first interface is smaller than a preset data space threshold (e.g., the preset data space threshold is 1 KB). If the size of the remaining space of the cache space corresponding to the first interface is smaller than the data space threshold, the historical data of the cache space corresponding to the first interface may be migrated to a standby server, and the historical data may be migrated to the standby server having the attribute of a cloud server through directional network connection during data migration. At this time, after the historical data is migrated, the cache space corresponding to the first interface is emptied, and the current notification information can be normally received and stored. And finally, the message server automatically sends an information acquisition request to the background server to request the background server to resend the current notification information, so that the phenomenon that the current notification information is lost is avoided. A
If the size of the remaining space of the cache space corresponding to the first interface is greater than or equal to the data space threshold, it indicates that the cache space corresponding to the first interface may fail to receive the current notification information due to other failures, send suspected failure information to the background server (the suspected failure information indicates that the message server is suspected of having a failure), and the background server pushes the maintenance notification information to a preset receiving end (a user of the receiving end is an operation and maintenance person of the message server), so as to ensure the timely maintenance of the message server.
The method realizes cross-platform message pushing through the first interface and the second interface in the server, and the same message pushing platform is integrated by the first interface and the second interface, thereby reducing development and maintenance cost.
The embodiment of the invention also provides a cross-platform message pushing device, which is used for executing any embodiment of the cross-platform message pushing method. Specifically, referring to fig. 7, fig. 7 is a schematic block diagram of a cross-platform message pushing apparatus according to an embodiment of the present invention. The cross-platform message pushing device 100 may be configured in a server.
As shown in fig. 7, the cross-platform message pushing apparatus 100 includes a first interface configuration unit 110, a second interface generation unit 120, an information receiving determination unit 130, and an information cross-platform pushing unit 140.
The first interface configuration unit 110 is configured to receive first interface configuration information, and configure a first interface for receiving and storing notification information sent by the message server according to the first interface configuration information.
In this embodiment, the message server (which may be understood as a message push system, and may also be referred to as a server for short) may serve as a message relay station, and receive the notification information sent by the backend server. In order to realize that the message transfer station of the message server can simultaneously push the notification information to the Android end and the iOS end when receiving the notification information sent by the background server, a middle layer interface (the middle layer interface is denoted as a first interface) capable of receiving, reading, storing and deleting the information needs to be configured in the message server, and the first interface is configured through C + + language during specific implementation.
In one embodiment, as shown in fig. 8, the first interface configuration unit 110 includes:
an add interface creating unit 111, configured to create a message add interface according to a message interface function in the first interface configuration information;
an update interface creating unit 112, configured to create a message update interface according to a message update function in the first interface configuration information;
a delete interface creating unit 113, configured to create a message delete interface according to the message delete function in the first interface configuration information;
an interface encapsulation unit 114, configured to encapsulate the message add interface, the message update interface, and the message delete interface to obtain a first interface.
In this embodiment, the created message adding interface is mainly used for: adding general messages, inserting new messages into the general data table in batches, and realizing through an AddMessaageAll () function. And adding personal messages: inserting new messages into the user data table according to the user id is realized through an addmessage (interuserid) function.
The message update interface is mainly used for: the division into batch update messages is implemented by the UpdateMessageAll () function. And an update message, wherein the update message is realized by setting the state of the message as read or unread through an UpdateMessage (messageid) function.
The message deletion interface is mainly used for: bulk delete, implemented by the DeleteMessaageAll () function. And a delete, implemented by a DeleteMessage (messageid) function.
Through the 3 types of functions provided by C + +, a first interface capable of receiving, reading, storing and deleting messages can be configured. After the configuration of the first interface is completed, whether the current notification information sent by the background server is received or not can be detected, and therefore the current notification information is uniformly distributed to the Android end and the iOS end.
The second interface generating unit 120 is configured to receive second interface configuration information, perform C header file conversion according to a predefined local method to add to a dynamic link library project, and obtain a second interface used for calling notification information in the first interface to push the notification information to the Android end.
In this embodiment, a layer of interface is specifically encapsulated by using a JNI technology (JNI is called Java native interface, which means Java native interface) for the Android client to call, that is, a second interface which communicates with the first interface and can call the notification information in the first interface is configured in the message server to push the notification information to the Android client.
Wherein the native method is native method in Java. The native method is an interface for calling non-java code by java, namely the native method is a java method: the method is implemented by a non-java language, such as C. This feature is not unique to java, and many other programming languages have this mechanism, such as in C + +, which can tell the C + + compiler with an extern "C" to call a C function.
In an embodiment, as shown in fig. 9, the second interface generating unit 120 includes:
a local method definition unit 121, configured to create a Java class, and define a local method in the Java class; wherein the local method is for a first interface;
a C header file generating unit 122, configured to generate a C header file corresponding to the local method through a javah instruction;
a dynamic link library file generating unit 123, configured to create a dynamic link library project, and add the C header file to the dynamic link library project to generate a dynamic link library file;
and the dynamic link library file packaging unit 124 is configured to package the dynamic link library file to obtain the second interface.
In this embodiment, a Java class is created first, and a local method in the Java class is defined; in specific implementation, the method modified by the native keyword is a local method in the Java class.
Then, entering a directory where the local method is located in a DOS window in the message server, then executing a javahcom.test.TestNative command, and after the execution is finished, generating a header file with a suffix name h in the current directory, such as com _ test _ TestNative.h, wherein the header file is named according to a package name and a class name.
Then, a Dynamic link library project (i.e., DLL project, or Win32Dynamic-LinkLibrary project) is created, the generated C header file is added to the DLL project, and then a source file is created to refer to the header file and implement the function of the local function in the header file.
And finally, packaging the dynamic link library file to obtain a second interface, wherein the second interface, namely a JNI interface, calls the dynamic link library file to read the notification information in the first interface.
An information receiving and determining unit 130, configured to determine whether the first interface receives current notification information pushed by the background server.
In this embodiment, after the configuration of the first interface and the second interface is completed, whether the current notification information pushed by the background server is received is detected through a message update interface in the first interface. The detection is carried out through the first interface in a unified mode, and the current notification information sent to the Android terminal and the iOS terminal is conveniently received and distributed in a unified mode.
The information cross-platform pushing unit 140 is configured to, if the first interface receives the current notification information pushed by the background server, send the current notification information to an iOS end through the first interface, and/or read the current notification information in the first interface through the second interface to send the current notification information to an Android end.
In this embodiment, please refer to the schematic diagram of message delivery shown in fig. 5, that is, each time the background server pushes the current notification information, the current notification information is first read by the first interface in the message server. The current notification information is pushed to the Android terminal and the iOS terminal at the same time, then the Android/IOS client terminal is notified that a new message exists and is displayed in a status bar, at the moment, the current notification information needs to be sent to the iOS terminal through the first interface, and/or the current notification information in the first interface is read through the second interface to be sent to the Android terminal. Because the same set of message pushing platform is integrated by the first interface and the second interface, development and maintenance cost is reduced, and cross-platform pushing of messages is realized.
In one embodiment, as shown in fig. 10, the information cross-platform pushing unit 140 includes:
an identifier obtaining unit 141, configured to analyze the current notification information to obtain a value of a message identifier in the current notification information;
the first pushing unit 142 is configured to send the current notification information to the second interface through the first interface if the message identification bit takes the value of Android, and the second interface sends the current notification information to corresponding Android terminals in an Android terminal device list according to a stored Android terminal device list;
the second pushing unit 143, configured to send the current notification information to each iOS end corresponding to the iOS end device list according to the stored iOS end device list if the value of the message identifier bit is iOS;
a third pushing unit 144, configured to send the current notification information to the second interface through the first interface if the value of the message identifier is Android & iOS, where the second interface sends the current notification information to each Android end corresponding to the Android end device list according to the stored Android end device list, and the first interface sends the current notification information to each iOS end corresponding to the iOS end device list according to the stored iOS end device list.
In this embodiment, in order to determine the push object of each notification message, the message server needs to analyze the push object to obtain the value of the message identifier in the current notification message. For example, if the value of the message identification bit is Android, the message identification bit indicates that the notification message needs to be sent to an Android terminal; if the message identification bit takes the value of iOS, the notification message is sent to the iOS terminal; and if the value of the message identification bit is Android & iOS, the notification message is sent to the iOS terminal and the Android terminal at the same time.
In the intermediate layer of the first interface, an Android end device list and an iOS end device list are stored in advance, unique device identification codes (such as mobile phone serial numbers (IMEI codes)) of devices in each list are known, the Android end device list can be used for establishing contact with a corresponding Android end and pushing messages, and the iOS end device list can be used for establishing contact with a corresponding iOS end and pushing messages.
By means of the value of the message identification bit, messages can be pushed to the Android terminal and the iOS terminal at the same time or messages can be pushed to a terminal corresponding to one system of the Android terminal and the iOS terminal.
In an embodiment, the cross-platform message pushing apparatus 100 further includes:
the heartbeat request receiving unit is used for receiving heartbeat requests sent by the Android end and/or the iOS end;
the first online list obtaining unit is used for obtaining a unique device identification code corresponding to the Android terminal in each heartbeat request so as to construct an Android terminal device list;
and the second online list acquisition unit is used for acquiring the unique equipment identification code corresponding to the iOS end in each heartbeat request so as to construct an iOS end equipment list.
In this embodiment, in order to accurately obtain the Android device list and the iOS device list, each terminal (e.g., the Android device or the iOS device) needs to first send a heartbeat request to the message server, which indicates that the terminal is requested to be kept online and that the terminal is simultaneously uploaded with the heartbeat request, and the heartbeat request is transmitted to the unique device identifier (e.g., a serial number of the smart phone). Specifically, a unique device identification code corresponding to an Android terminal in each heartbeat request is obtained to construct an Android terminal device list; and acquiring the unique equipment identification code corresponding to the iOS end in each heartbeat request to construct an iOS end equipment list. After receiving the heartbeat request of each terminal, the message server can clearly know which terminals are in the online state and add the terminal to the corresponding equipment list. By the method, the corresponding terminals in the Android end device list or the iOS end device list stored in the message server are ensured to be in the online state, and the current notification information pushed by the message server can be successfully received.
In an embodiment, the cross-platform message pushing apparatus 100 further includes:
a remaining space determining unit, configured to determine whether a size of a remaining space of a cache space corresponding to the first interface is smaller than a preset data space threshold if the first interface does not receive the current notification information pushed by the message server;
a data migration unit, configured to migrate, if the size of the remaining space of the cache space corresponding to the first interface is smaller than the data space threshold, historical data of the cache space corresponding to the first interface to a standby server;
and the data re-request unit is used for sending an information acquisition request to the background server.
In this embodiment, if the first interface does not receive the current notification information pushed by the message server, one of the reasons is that the cache space corresponding to the first interface has no remaining space to store the current notification information. At this time, in order to further determine whether the current notification information is stored in the cache space without any remaining space, it may be determined whether the size of the remaining space of the cache space corresponding to the first interface is smaller than a preset data space threshold (e.g., the preset data space threshold is 1 KB). If the size of the remaining space of the cache space corresponding to the first interface is smaller than the data space threshold, the historical data of the cache space corresponding to the first interface may be migrated to a standby server, and the historical data may be migrated to the standby server having the attribute of a cloud server through directional network connection during data migration. At this time, after the historical data is migrated, the cache space corresponding to the first interface is emptied, and the current notification information can be normally received and stored. And finally, the message server automatically sends an information acquisition request to the background server to request the background server to resend the current notification information, so that the phenomenon that the current notification information is lost is avoided. A
If the size of the remaining space of the cache space corresponding to the first interface is greater than or equal to the data space threshold, it indicates that the cache space corresponding to the first interface may fail to receive the current notification information due to other failures, send suspected failure information to the background server (the suspected failure information indicates that the message server is suspected of having a failure), and the background server pushes the maintenance notification information to a preset receiving end (a user of the receiving end is an operation and maintenance person of the message server), so as to ensure the timely maintenance of the message server.
The device realizes cross-platform message pushing through the first interface and the second interface in the server, and the same set of message pushing platform is integrated by the first interface and the second interface, so that the development and maintenance cost is reduced.
The cross-platform message pushing apparatus may be implemented in the form of a computer program, which can run on a computer device as shown in fig. 11.
Referring to fig. 11, fig. 11 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 is a server, and the server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 11, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, may cause the processor 502 to perform a cross-platform message push method.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute the cross-platform message pushing method.
The network interface 505 is used for network communication, such as providing transmission of data information. Those skilled in the art will appreciate that the configuration shown in fig. 11 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing device 500 to which aspects of the present invention may be applied, and that a particular computing device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run a computer program 5032 stored in the memory to implement the cross-platform message pushing method disclosed in the embodiment of the present invention.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 11 does not constitute a limitation on the specific construction of the computer device, and that in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 11, and are not described herein again.
It should be understood that, in the embodiment of the present invention, the processor 502 may be a Central Processing Unit (CPU), and the processor 502 may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the invention, a computer-readable storage medium is provided. The computer readable storage medium may be a non-volatile computer readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the cross-platform message pushing method disclosed by the embodiments of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A cross-platform message pushing method is characterized by comprising the following steps:
receiving first interface configuration information, and configuring a first interface for receiving and storing notification information sent by a message server according to the first interface configuration information;
converting a C header file according to a predefined local method to add the C header file to a dynamic link library project, and obtaining a second interface for calling the notification information in the first interface to push the notification information to an Android end;
judging whether the first interface receives current notification information pushed by a background server; and
if the first interface receives the current notification information pushed by the background server, the current notification information is sent to an iOS end through the first interface, and/or the current notification information in the first interface is read through the second interface to be sent to an Android end.
2. The cross-platform message pushing method according to claim 1, wherein the configuring, according to the first interface configuration information, a first interface for receiving and storing notification information sent by a message server includes:
creating a message adding interface according to a message interface function in the first interface configuration information;
establishing a message updating interface according to a message updating function in the first interface configuration information;
creating a message deleting interface according to a message deleting function in the first interface configuration information;
and packaging the message adding interface, the message updating interface and the message deleting interface to obtain a first interface.
3. The method for pushing the cross-platform message according to claim 1, wherein the converting a C header file according to a predefined local method to add to a dynamic link library project to obtain a second interface for calling the notification information in the first interface to push to an Android end includes:
creating a Java class and defining a local method in the Java class; wherein the local method is for a first interface;
generating a C header file corresponding to the local method through a javah instruction;
creating a dynamic link library project, and adding the C-header file to the dynamic link library project to generate a dynamic link library file;
and packaging the dynamic link library file to obtain the second interface.
4. The cross-platform message pushing method according to claim 1, wherein the sending the current notification information to an iOS terminal through the first interface, and/or reading the current notification information in the first interface through the second interface to send to an Android terminal includes:
analyzing the current notification information to obtain a message identification bit value in the current notification information;
if the message identification bit takes the value of Android, the current notification information is sent to the second interface from the first interface, and the second interface sends the current notification information to corresponding Android terminals in an Android terminal equipment list according to a stored Android terminal equipment list;
if the message identification bit takes the value of iOS, the first interface sends the current notification information to each iOS end corresponding to the iOS end equipment list according to the stored iOS end equipment list;
and if the message identification bit takes the value of Android & iOS, sending the current notification information to the second interface from the first interface, sending the current notification information to each Android end corresponding to the Android end equipment list by the second interface according to the stored Android end equipment list, and sending the current notification information to each iOS end corresponding to the iOS end equipment list by the first interface according to the stored iOS end equipment list.
5. The cross-platform message pushing method according to claim 4, wherein before analyzing the current notification information to obtain a message flag value in the current notification information, the method further comprises:
receiving a heartbeat request sent by an Android terminal and/or an iOS terminal;
acquiring a unique equipment identification code corresponding to an Android terminal in each heartbeat request to construct an Android terminal equipment list;
and acquiring the unique equipment identification code corresponding to the iOS end in each heartbeat request to construct an iOS end equipment list.
6. The cross-platform message pushing method according to claim 1, wherein after determining whether the first interface receives current notification information pushed by a background server, the method further comprises:
if the first interface does not receive the current notification information pushed by the message server, judging whether the size of the residual space of the cache space corresponding to the first interface is smaller than a preset data space threshold value;
if the size of the remaining space of the cache space corresponding to the first interface is smaller than the data space threshold, migrating the historical data of the cache space corresponding to the first interface to a standby server;
and sending an information acquisition request to the background server.
7. A cross-platform message pushing device, comprising:
the first interface configuration unit is used for receiving first interface configuration information and configuring a first interface for receiving and storing notification information sent by the message server according to the first interface configuration information;
the second interface generation unit is used for converting the C header file according to a predefined local method to add the C header file to the dynamic link library engineering to obtain a second interface used for calling the notification information in the first interface to push the notification information to the Android end;
the information receiving and judging unit is used for judging whether the first interface receives the current notification information pushed by the background server; and
and the information cross-platform pushing unit is used for sending the current notification information to an iOS (internet operating system) end through the first interface and/or reading the current notification information in the first interface through the second interface to send the current notification information to an Android end if the first interface receives the current notification information pushed by the background server.
8. The cross-platform message pushing device according to claim 7, wherein the information cross-platform pushing unit comprises:
an identification bit obtaining unit, configured to analyze the current notification information to obtain a message identification bit value in the current notification information;
the first pushing unit is used for sending the current notification information to the second interface from the first interface if the message identification bit takes the value of Android, and the second interface sends the current notification information to corresponding Android terminals in an Android terminal equipment list according to a stored Android terminal equipment list;
the second pushing unit is used for sending the current notification information to each iOS end corresponding to the iOS end equipment list by the first interface according to the stored iOS end equipment list if the value of the message identification bit is iOS;
and the third pushing unit is used for sending the current notification information to the second interface from the first interface if the message identification bit takes the value of Android & iOS, the second interface sends the current notification information to each Android end corresponding to the Android end equipment list according to the stored Android end equipment list, and the first interface sends the current notification information to each iOS end corresponding to the iOS end equipment list according to the stored iOS end equipment list.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the cross-platform message push method according to any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to execute the cross-platform message push method according to any one of claims 1 to 6.
CN202010023605.8A 2020-01-09 2020-01-09 Cross-platform message pushing method and device, computer equipment and storage medium Pending CN111245930A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010023605.8A CN111245930A (en) 2020-01-09 2020-01-09 Cross-platform message pushing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010023605.8A CN111245930A (en) 2020-01-09 2020-01-09 Cross-platform message pushing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111245930A true CN111245930A (en) 2020-06-05

Family

ID=70865557

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010023605.8A Pending CN111245930A (en) 2020-01-09 2020-01-09 Cross-platform message pushing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111245930A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112491998A (en) * 2020-11-18 2021-03-12 平安消费金融有限公司 Message pushing method and related equipment
CN112612517A (en) * 2020-12-18 2021-04-06 深圳市思为软件技术有限公司 Data acquisition method and related equipment
CN112669521A (en) * 2020-12-11 2021-04-16 深圳市智莱科技股份有限公司 Vending machine initialization method, vending machine and readable storage medium
CN113098936A (en) * 2021-03-25 2021-07-09 山东浪潮通软信息科技有限公司 Method, device and equipment for pushing message to mobile terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107544796A (en) * 2016-06-28 2018-01-05 广州市动景计算机科技有限公司 A kind of informing message display method, device and user terminal
CN108683733A (en) * 2018-05-15 2018-10-19 苏州玩友时代科技股份有限公司 Compatible full platform mobile phone supplying system and method
CN109684530A (en) * 2018-12-07 2019-04-26 石河子大学 Information Push Service system based on web-based management and the application of mobile phone small routine

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107544796A (en) * 2016-06-28 2018-01-05 广州市动景计算机科技有限公司 A kind of informing message display method, device and user terminal
CN108683733A (en) * 2018-05-15 2018-10-19 苏州玩友时代科技股份有限公司 Compatible full platform mobile phone supplying system and method
CN109684530A (en) * 2018-12-07 2019-04-26 石河子大学 Information Push Service system based on web-based management and the application of mobile phone small routine

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112491998A (en) * 2020-11-18 2021-03-12 平安消费金融有限公司 Message pushing method and related equipment
CN112491998B (en) * 2020-11-18 2023-08-08 平安消费金融有限公司 Message pushing method and related equipment
CN112669521A (en) * 2020-12-11 2021-04-16 深圳市智莱科技股份有限公司 Vending machine initialization method, vending machine and readable storage medium
CN112612517A (en) * 2020-12-18 2021-04-06 深圳市思为软件技术有限公司 Data acquisition method and related equipment
CN112612517B (en) * 2020-12-18 2024-04-05 深圳市思为软件技术有限公司 Data acquisition method and related equipment
CN113098936A (en) * 2021-03-25 2021-07-09 山东浪潮通软信息科技有限公司 Method, device and equipment for pushing message to mobile terminal

Similar Documents

Publication Publication Date Title
CN111245930A (en) Cross-platform message pushing method and device, computer equipment and storage medium
CN109739573B (en) Processing method and device for realizing API (application program interface) call and system for realizing API
CN110505162B (en) Message transmission method and device and electronic equipment
CN110825479A (en) Page processing method and device, terminal equipment, server and storage medium
CN110310139B (en) Data delivery method and data delivery engine device
CN110022260B (en) Cross-environment receipt message processing method and system
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN108418859B (en) Method and device for writing data
CN111949314A (en) Method and device for generating application installation package, server and storage medium
CN108132832B (en) Application program starting method and device
CN111385255B (en) Asynchronous call implementation method and device, server and server cluster
CN110870286B (en) Fault tolerance processing method and device and server
CN108600378B (en) File downloading method, device, terminal and storage medium
CN111722857A (en) Updating method and device of software development kit, electronic equipment and storage medium
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN110554963A (en) Application rollback method, device and storage medium
CN113779122B (en) Method and device for exporting data
CN106713453B (en) Application information monitoring method and device
CN114270309A (en) Resource acquisition method and device and electronic equipment
CN113760487A (en) Service processing method and device
CN111538514A (en) Enterprise application updating method and device, storage medium and electronic equipment
CN111176746A (en) Data configuration method, device and system, electronic equipment and storage medium thereof
CN110704066B (en) Code compiling method, device, equipment and storage medium
CN115914329A (en) Information pushing method and device, electronic equipment and readable storage medium
CN115408286A (en) Software automation test method and device suitable for multiple operating systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination