Message sending method, electronic equipment and computer readable storage medium

By registering and forming a network on the server between the smart watch and the mobile phone, far-field message interaction between the smart watch and the mobile phone is realized, and the message synchronization problem caused by the disconnection of Bluetooth is solved, ensuring that users are informed of notification messages in real time.

CN119316514APending Publication Date: 2025-01-14HONOR DEVICE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310962406.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-07-12
Filing Date
2023-07-31
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

The existing smartwatches and mobile phones can only be short-distance communication through Bluetooth, which makes it impossible to synchronize notification messages when they are far apart, causing inconvenience to users.

Method used

By registering the device in the first server and the second server, the far-field online perception and networking between the terminal and the wearable device are realized, and the conversation between the terminal and the wearable device is established to realize far-field message interaction, ensuring that both the terminal and the wearable device are The wearable devices can synchronize messages in a timely manner no matter how far apart they are.

Benefits of technology

Long-distance message synchronization between the terminal and the wearable device is realized, so that users can get the messages they care about in a timely manner, which greatly facilitates users' use and solves the message synchronization problem caused by disconnection of Bluetooth connection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316514A_ABST
    Figure CN119316514A_ABST
Patent Text Reader

Abstract

The invention discloses a message sending method, electronic equipment and a computer readable storage medium, and belongs to the technical field of computers. The method comprises the steps that one of a first device and a second device is a terminal, and the other is a wearable device. And after the short-distance communication connection is established between the first equipment and the second equipment, the first equipment performs equipment registration on the first server and performs equipment registration on the second server. And after the short-distance communication connection between the first equipment and the second equipment is disconnected, if the first equipment determines that the second equipment is online through the first server, the first equipment and the second equipment are networked. And after the first equipment and the second equipment finish networking, the first equipment creates a session between the first equipment and the second equipment through the second server, and sends the target message in the first equipment to the second equipment through the session. According to the invention, far-field message interaction between the terminal and the wearable device can be realized, so that a user can know the concerned message in time.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese patent application No. 202310862173.3 filed on July 12, 2023, and application name “A method for far-field interaction between a mobile phone and a watch”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a message sending method, an electronic device, and a computer-readable storage medium. Background Art

[0003] As people's living standards improve, smart watches are becoming increasingly popular. When using smart watches, users can pair them with mobile phones via Bluetooth. In this case, notification messages in the mobile phone can be synchronized to the smart watch, so that users can know in time. However, Bluetooth can only achieve short-range communication. If the smart watch is far away from the mobile phone, the Bluetooth connection between the smart watch and the mobile phone will be disconnected, and the notification messages in the mobile phone will not be synchronized to the smart watch. Summary of the invention

[0004] The present application provides a message sending method, an electronic device and a computer-readable storage medium, which can realize far-field message interaction between a terminal and a wearable device. The technical solution is as follows:

[0005] In a first aspect, a message sending method is provided, which is applied to a first device, wherein one of the first device and a second device is a terminal and the other is a wearable device, and the wearable device has a network access capability.

[0006] After the first device and the second device establish a short-distance communication connection, the first device registers the device on the first server and registers the device on the second server. After the short-distance communication connection between the first device and the second device is disconnected, if the first device determines through the first server that the second device is online, the first device and the second device are networked. After the first device and the second device complete the networking, the first device creates a session between the first device and the second device through the second server, and sends the target message in the first device to the second device through the session.

[0007] In this application, the terminal and the wearable device can realize the far-field online perception and far-field networking of the terminal and the wearable device by registering the device in the first server and the second server, and then establish a session between the terminal and the wearable device through the second server, and realize the far-field message interaction between the terminal and the wearable device through the session. In this case, no matter how far the terminal and the wearable device are apart, the message synchronization between the terminal and the wearable device can be realized in time, so that the user can know the message he is concerned about in time, which greatly facilitates the user's use.

[0008] Optionally, after the first device establishes a short-range communication connection with the second device, the operation of registering the device on the first server and registering the device on the second server can be: after the first device establishes a short-range communication connection with the second device, the first device synchronizes the account with the second device; after completing the account synchronization with the second device, if it is detected that the far-field message switch is switched from the off state to the on state, the device is registered on the first server, and the service channel is registered on the second server.

[0009] In the present application, after the first device and the second device complete account synchronization, if the first device detects that its far-field message switch is switched from the off state to the on state, indicating that the far-field message capability is currently supported, the device can be registered on the first server, and the device can be registered on the second server so that subsequent far-field message synchronization can be achieved.

[0010] Optionally, if the first device logs out of the account, or if the far-field message switch is switched from the on state to the off state, the first device can also deregister the device on the first server and deregister the device on the second server.

[0011] In the present application, if the first device logs out of the account, or if the far-field message switch in the first device is switched from the on state to the off state, it means that the first device currently does not support the far-field message capability. Therefore, the first device can deregister the device on the first server and deregister the device on the second server to turn off the far-field message capability.

[0012] Optionally, the first device can also obtain a device list from the first server, the device list including the online and offline status of the second device; and / or, receive a device online notification message sent by the first server, the device online notification message is used to indicate that the second device is online; and / or, receive a device offline notification message sent by the first server, the device offline notification message is used to indicate that the second device is offline.

[0013] In this application, the first device can timely learn the online and offline status of the second device by pulling the device list, or by receiving the device online notification message or device offline notification message sent by the first server. In this way, it is convenient for the first device to network with the online second device in time.

[0014] Optionally, the operation of networking with the second device may be: the first device sends a device authentication request message to the second device through the first server; if a confirmation message for the device authentication request message is received from the second device, the same account authentication is performed with the second device; after completing the same account authentication with the second device, a networking request message is sent to the second device through the first server; and a confirmation message for the networking request message is received from the second device.

[0015] In the present application, the first device and the second device are remotely networked only after the same account authentication is performed, thereby ensuring the data security during the subsequent remote field message synchronization between the first device and the second device.

[0016] Optionally, after sending the networking request message to the second device through the first server, the first device may also clear the networking relationship with the second device when receiving a rejection message for the networking request message returned by the second device.

[0017] The first device clearing the networking relationship with the second device means that the first device no longer actively initiates far-field networking with the second device when sensing that the second device is online.

[0018] Optionally, after the first device completes networking with the second device, if it detects that the target application has entered the foreground, a unilateral periodic heartbeat task message is sent to the second device through the first server, and the unilateral periodic heartbeat task message is used to instruct the second device to periodically send heartbeat messages to the first device within a first preset time period; within the first preset time period after sending the unilateral periodic heartbeat task message, if the target application exits the foreground, or if the first device switches to the screen-off state, a unilateral periodic heartbeat task stop message is sent to the second device through the first server.

[0019] In this application, when the target application is running in the foreground, the first device can timely perceive the online and offline status of the second device. In addition, since the unilateral periodic heartbeat task is that the second device periodically sends a heartbeat message to the first device, and the first device does not need to return a heartbeat response to the second device, the power consumption of the first device can be saved.

[0020] Optionally, the operation of creating a session between the first device and the second device through the second server can be: if the first device generates a target message, a session creation notification message is sent to the second device through the first server, and the session creation notification message is used to instruct the second device to create a session; if a confirmation message for the session creation notification message is received from the second device, a session creation request message is sent to the second server, and the session creation request message is used to request to create a session with the second device; and a session creation success message is received from the second server.

[0021] In the present application, the first device can instruct the second device to create a session through the first server, and then both the first device and the second device can request the second server to create a session. In this case, the second server will create a session between the first device and the second device, thereby ensuring the data security of the created session.

[0022] In a second aspect, a message sending device is provided, the message sending device has the function of implementing the message sending method behavior in the first aspect. The message sending device includes at least one module, and the at least one module is used to implement the message sending method provided in the first aspect.

[0023] In a third aspect, an electronic device is provided, wherein the structure of the electronic device includes a processor and a memory, wherein the memory is used to store a program that supports the electronic device to execute the message sending method provided in the first aspect, and to store data involved in implementing the message sending method described in the first aspect. The processor is configured to execute the program stored in the memory. The electronic device may also include a communication bus, wherein the communication bus is used to establish a connection between the processor and the memory.

[0024] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer executes the message sending method described in the first aspect.

[0025] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the message sending method described in the first aspect.

[0026] The technical effects obtained by the above-mentioned second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 This is a schematic diagram of a Bluetooth connection between a mobile phone and a smart watch provided in an embodiment of the present application;

[0028] Figure 2 is a schematic diagram of a communication system provided in an embodiment of the present application;

[0029] Figure 3 is a schematic diagram of another communication system provided in an embodiment of the present application;

[0030] Figure 4 is a schematic diagram of another communication system provided in an embodiment of the present application;

[0031] Figure 5is a schematic diagram of a device pairing process provided in an embodiment of the present application;

[0032] Figure 6 is a flow chart of a message sending method provided by an embodiment of the present application;

[0033] Figure 7 is a schematic diagram of a device registration process provided by an embodiment of the present application;

[0034] Figure 8 is a schematic diagram of another device registration process provided by an embodiment of the present application;

[0035] Fig. 9 is a schematic diagram of a device deregistration process provided by an embodiment of the present application;

[0036] Fig.10 It is a schematic diagram of a device online and offline process provided by an embodiment of the present application;

[0037] Fig.11 It is a schematic diagram of a device networking process provided by an embodiment of the present application;

[0038] Fig.12 is a schematic diagram of another device networking process provided in an embodiment of the present application;

[0039] Fig.13 It is a schematic diagram of a device networking heartbeat provided in an embodiment of the present application;

[0040] Fig.14 is a schematic diagram of a session creation process provided by an embodiment of the present application;

[0041] Fig.15 is a schematic diagram of another session creation process provided by an embodiment of the present application;

[0042] Fig.16 is a schematic diagram of a session closing process provided by an embodiment of the present application;

[0043] Fig.17 is a schematic diagram of a wearable device switching a connected terminal provided by an embodiment of the present application;

[0044] Fig.18 is a schematic diagram of a wearable device connected to a terminal switching provided in an embodiment of the present application;

[0045] Fig.19 It is a structural diagram of a message sending device provided in an embodiment of the present application;

[0046] Fig. 20 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0047] Fig.21 is a schematic diagram of the structure of a wearable device provided in an embodiment of the present application;

[0048] Fig. 22 It is a block diagram of a software system of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0050] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0051] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" that appear in the differences in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. In addition, the terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0052] The application scenarios involved in the embodiments of the present application are described below.

[0053] As people's living standards improve, smart watches are becoming more and more popular. Figure 1As shown, when using a smartwatch, the user can use Bluetooth to pair the smartwatch with the mobile phone. In this case, the notification messages in the mobile phone can be synchronized to the smartwatch, so that the user can know in time. However, in some special scenarios, such as when the user is exercising outdoors, he may wear a smartwatch but not carry a mobile phone. In this case, since the smartwatch is far away from the mobile phone, the Bluetooth connection between the smartwatch and the mobile phone will be disconnected, and the notification messages in the mobile phone cannot be synchronized to the smartwatch, resulting in the user being unable to get the notification messages he cares about through the smartwatch.

[0054] It can be seen that currently, mobile phones and smart watches can only achieve short-distance communication (also known as near-field communication) through Bluetooth, which brings inconvenience to users. To this end, the embodiment of the present application provides a message sending method that can achieve long-distance communication (also known as far-field communication) between mobile phones and smart watches. In this way, no matter how far the mobile phone and the smart watch are apart, the notification messages in the mobile phone can be synchronized to the smart watch in time, and at the same time, the notification messages in the smart watch can also be synchronized to the mobile phone in time, so that the user can be informed of the notification messages he is concerned about in time, which greatly facilitates the user's use.

[0055] The system architecture involved in the embodiments of the present application is described below.

[0056] Figure 2 is a schematic diagram of a communication system provided in an embodiment of the present application. Figure 2 , the communication system may include a terminal 201, a wearable device 202, a first server 203 and a second server 204.

[0057] The terminal 201 may be a mobile phone, a tablet computer, a car computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., which is not limited in the embodiments of the present application. The terminal 201 supports short-range communication technology, which may include but is not limited to Bluetooth technology, etc. In addition, the terminal 201 has network access capability. For example, the terminal 201 may access the network through wireless fidelity (Wi-Fi) communication technology, mobile communication technology (including but not limited to 2G / 3G / 4G / 5G, etc.). For example, a subscriber identification module (SIM) card may be provided in the terminal 201, and the network may be accessed through the SIM card. In some embodiments, the SIM card in the terminal 201 may be an eSIM card, i.e., an embedded SIM card. The eSIM card may be embedded in the terminal 201 and cannot be separated from the terminal 201.

[0058] The wearable device 202 may be a smart watch, a smart bracelet, a smart ring, etc., which is not limited in the embodiments of the present application. The wearable device 202 supports short-range communication technology, which may include but is not limited to Bluetooth, etc. In addition, the wearable device 202 has network access capability. For example, the wearable device 202 can access the network through Wi-Fi communication technology, mobile communication technology (including but not limited to 2G / 3G / 4G / 5G, etc.). For example, a SIM card may be provided in the wearable device 202, through which the network can be accessed. In some embodiments, the SIM card in the wearable device 202 may be an eSIM card, that is, an embedded SIM card. The eSIM card can be embedded in the wearable device 202 and cannot be separated from the wearable device 202.

[0059] The first server 203 may also be referred to as a device server. The first server 203 and the terminal 201 may communicate via a wired connection or a wireless connection, and the first server 203 and the wearable device 202 may also communicate via a wired connection or a wireless connection. The first server 203 is used to implement functions such as device registration, device far-field discovery, device far-field networking, device networking heartbeat, and device deregistration.

[0060] The second server 204 may also be referred to as a service server. The second server 204 may communicate with the terminal 201 via a wired connection or a wireless connection, and the second server 204 may also communicate with the wearable device 202 via a wired connection or a wireless connection. The second server 204 is used to implement functions such as device registration, session creation, message interaction, and session closing.

[0061] In some embodiments, Figure 3 As shown, the communication system may further include a third server 205. The third server 205 may also be referred to as a push server (i.e., a PUSH server). The third server 205 may communicate with the terminal 201 via a wired connection or a wireless connection, and the third server 205 may also communicate with the first server 203 via a wired connection or a wireless connection. The third server 205 is used to forward messages sent by the first server 203 to the terminal 201.

[0062] It should be noted that the first server 203, the second server 204, or the third server 205 can be a single server or a server cluster including multiple servers, which is not limited in the present application embodiment. For example, the first server 203, the second server 204, or the third server 205 can be a cloud server.

[0063] In some embodiments, Figure 4 As shown, the terminal 201 may include a target application, a management module, a basic communication middle station and a trust ring module. Further, the terminal 201 may also include a message service module (not shown in the figure). The wearable device 202 may include a message service module, a management module, a basic communication middle station and a trust ring module. Further, the wearable device 202 may also include a target application (not shown in the figure).

[0064] The terminal 201 can log in to an account, and the target application in the terminal 201 can obtain and use the account logged in by the terminal 201. The wearable device 202 can also log in to an account, and the target application in the wearable device 202 can also obtain and use the account logged in by the wearable device 202.

[0065] The target application in the terminal 201 is an application that can generate messages and synchronize the generated messages to the wearable device 202. For example, the target application in the terminal 201 can be a text message application, a calendar application, a note application, a sports and health application, etc., which is not limited in the embodiment of the present application.

[0066] The target application in the wearable device 202 is an application that can generate messages and synchronize the generated messages to the terminal 201. For example, the target application in the wearable device 202 can be a calendar application, a sports and health application, etc., which is not limited in the embodiment of the present application.

[0067] The terminal 201 can establish a short-range communication connection with the wearable device 202. For example, it is assumed that the short-range communication connection is a Bluetooth connection. Both the terminal 201 and the wearable device 202 can turn on the Bluetooth switch. In this case, if the terminal 201 and the wearable device 202 have not been paired before, the management module in the terminal 201 and the management module in the wearable device 202 can perform device discovery and device pairing, and then the terminal 201 and the wearable device 202 can be connected via Bluetooth; and if the terminal 201 and the wearable device 202 have been paired before, the terminal 201 and the wearable device 202 can directly connect via Bluetooth.

[0068] In some embodiments, the establishment of the short-range communication connection between the terminal 201 and the wearable device 202 can be triggered by the user. For example, assuming that the terminal 201 is a mobile phone, the wearable device 202 is a smart watch, and the target application is a sports and health application. When the Bluetooth switch in the mobile phone and the Bluetooth switch in the smart watch are both turned on, Figure 5 As shown in Figure 1, users can open the sports health application in their mobile phones. Figure 5 As shown in Figure (a) in the figure, the user can click the Add Device button in the application interface of the sports health application to trigger the mobile phone to enter the Figure 5 After entering the Add Device page, the phone scans for available devices nearby. If the phone finds a smartwatch, Figure 5 As shown in Figure (c) in the figure, the phone displays the name of the smart watch found. Figure 5 As shown in Figure (c), the user clicks the start pairing button to trigger the mobile phone and the smart watch to pair devices. After the device pairing is completed, the mobile phone and the smart watch establish a Bluetooth connection.

[0069] After the terminal 201 and the wearable device 202 establish a short-distance communication connection, if the terminal 201 and the wearable device 202 establish a short-distance communication connection for the first time, the terminal 201 and the wearable device 202 can synchronize their accounts, and if the terminal 201 and the wearable device 202 do not establish a short-distance communication connection for the first time, the terminal 201 and the wearable device 202 can perform same-account authentication. For example, the management module in the terminal 201 and the management module in the wearable device 202 can complete operations such as account synchronization and same-account authentication through the trust ring module in the terminal 201 and the trust ring module in the wearable device 202. Among them, the trust ring module is used to ensure account security and can realize functions such as account synchronization and same-account authentication. Among them, account synchronization refers to controlling the terminal 201 and the wearable device 202 to log in to the same account. Same-account authentication refers to verifying whether the account logged in by the terminal 201 and the account logged in by the wearable device 202 are the same account.

[0070] In some embodiments, after the terminal 201 and the wearable device 202 complete account synchronization or same account authentication, the terminal 201 and the wearable device 202 can enable the far-field message capability. In some embodiments, the terminal 201 or the wearable device 202 can guide the user to enable the far-field message capability. For example, the terminal 201 or the wearable device 202 can display a reminder message to remind the user to turn on the far-field message switch. Among them, the far-field message capability is supported when the far-field message switch is in the on state, and the far-field message capability is not supported when the far-field message switch is in the off state. For example, the far-field message switch in the terminal 201 can be a notification sharing switch in the smart interconnection function in the terminal 201.

[0071] After the terminal 201 and the wearable device 202 enable the far-field message capability, both the terminal 201 and the wearable device 202 can register the device on the first server 203, and can register the device on the second server 204. Since the second server 204 is used to implement business functions, registering the device on the second server 204 can also be referred to as registering the business channel on the second server 204. For example, the management module in the terminal 201 and the management module in the wearable device 202 can register the device on the first server 203, the management module in the terminal 201 can register the device on the second server 204 through the basic communication middle station in the terminal 201, and the management module in the wearable device 202 can register the business channel on the second server 204 through the basic communication middle station in the wearable device 202.

[0072] In some embodiments, the terminal 201 or the wearable device 202 can log out of the device on the first server 203 and the second server 204 when logging out of the account or detecting that the far-field message switch of the terminal 201 or the wearable device 202 is switched from the on state to the off state, wherein the device logout on the second server 204 can also be referred to as the service channel logout on the second server 204. For example, the management module in the terminal 201 and the management module in the wearable device 202 can log out of the device on the first server 203, the management module in the terminal 201 can log out of the device on the second server 204 through the basic communication middle station in the terminal 201, and the management module in the wearable device 202 can log out of the service channel on the second server 204 through the basic communication middle station in the wearable device 202.

[0073] After the terminal 201 and the wearable device 202 perform device registration on the first server 203 and the device registration on the second server 204, if the short-range communication connection between the terminal 201 and the wearable device 202 is disconnected, the terminal 201 and the wearable device 202 can use the far-field message capability to complete the synchronization of messages in the terminal 201 to the wearable device 202, and complete the synchronization of messages in the wearable device 202 to the terminal 201.

[0074] Specifically, after the short-distance communication connection between the wearable device 202 and the terminal 201 is disconnected, the wearable device 202 can establish a long connection with the first server 203, and this long connection is used to allow the terminal 201 to discover that the wearable device 202 is online in the far field. When the terminal 201 determines that the wearable device 202 is online in the far field, it can perform far-field networking with the wearable device 202. After the terminal 201 and the wearable device 202 complete the far-field networking, if the terminal 201 has a far-field message synchronization requirement, a session (i.e., a service channel) between the terminal 201 and the wearable device 202 can be created through the second server 204, and then the message interaction between the terminal 201 and the wearable device 202 is realized through the session.

[0075] For example, when the management module in the terminal 201 finds that the target application has a message that needs to be synchronized to the wearable device 202, the management module in the terminal 201 can instruct the second server 204 to create a session between the terminal 201 and the wearable device 202 through the basic communication middle station in the terminal 201. After the session between the terminal 201 and the wearable device 202 is successfully created, the terminal 201 can transmit the message generated by the target application to the basic communication middle station in the terminal 201, and the basic communication middle station in the terminal 201 sends the message to the wearable device 202 through the session. After receiving the message, the basic communication middle station in the wearable device 202 can transmit the message to the management module in the wearable device 202, and the management module in the wearable device 202 can transmit the message to the message service module in the wearable device 202, and the message service module in the wearable device 202 can display the message on the screen of the wearable device 202.

[0076] The message sending method provided in the embodiment of the present application is explained in detail below.

[0077] Figure 6 is a flow chart of a message sending method provided by an embodiment of the present application. Figure 6 The method is applied to a first device and a second device, one of the first device and the second device is a terminal and the other is a wearable device, and the wearable device has a network access capability. For example, the terminal can be the above Figures 2 to 4 The terminal 201 described in the embodiment, the wearable device can be the above Figures 2 to 4 The wearable device 202 described in the embodiment. The method comprises the following steps:

[0078] Step 601: A first device establishes a short-range communication connection with a second device.

[0079] Generally, the first device and the second device can establish a short-distance communication connection when they are close to each other. For example, the short-distance communication connection can be a Bluetooth connection. Of course, the short-distance communication connection can also be other connections, which is not limited in the embodiments of the present application.

[0080] For example, assuming that the short-range communication connection is a Bluetooth connection. The first device and the second device can both turn on the Bluetooth switch. In this case, if the first device and the second device have not been paired before, the first device and the second device can perform device discovery and device pairing, and then the first device and the second device can be connected to each other through Bluetooth; and if the first device and the second device have been paired before, the first device and the second device can be directly connected to each other through Bluetooth.

[0081] Step 602: After the first device establishes a short-distance communication connection with the second device, the first device and the second device both register the devices on the first server and register the devices on the second server.

[0082] In some embodiments, after the first device and the second device establish a short-distance communication connection, if the first device and the second device are connected to each other for the first time for a short-distance communication connection, the first device and the second device perform account synchronization, and if the first device and the second device are not connected to each other for the first time for a short-distance communication connection, the first device and the second device can perform same-account authentication. Account synchronization refers to controlling the first device and the second device to log in to the same account. Same-account authentication refers to verifying whether the account logged in by the first device and the account logged in by the second device are the same account.

[0083] In the case of a short-distance communication connection between a first device and a second device, for any one of the first device and the second device, if this device detects that its far-field message switch is in the on state when the first device and the second device complete account synchronization or same-account authentication, or if this device detects that its far-field message switch is switched from the off state to the on state after the first device and the second device complete account synchronization or same-account authentication, then this device registers the device on the first server and registers the device on the second server.

[0084] In some embodiments, when a short-distance communication connection is established between a first device and a second device, for any one of the first device and the second device, if the far-field message switch in the device is not turned on when the first device and the second device complete account synchronization or same-account authentication, the device can guide the user to turn on the far-field message switch. For example, the device can display a reminder message to remind the user to turn on the far-field message switch. The far-field message switch supports the far-field message capability when it is turned on, and does not support the far-field message capability when it is turned off.

[0085] In this way, after the first device and the second device complete account synchronization or same account authentication, if the first device or the second device detects that its own far-field message switch is switched from the off state to the on state, it means that the far-field message capability is currently supported. Then, the device can be registered on the first server and the device can be registered on the second server so that subsequent far-field message synchronization can be achieved.

[0086] After the first device registers with the first server, it can obtain the device identification assigned to the first device by the first server, and the device identification assigned to the first device by the first server can be called the first identification of the first device. Similarly, after the second device registers with the first server, it can obtain the device identification assigned to the second device by the first server, and the device identification assigned to the second device by the first server can be called the first identification of the second device.

[0087] After the first device registers with the second server, it can obtain the device identification assigned to the first device by the second server, and the device identification assigned to the first device by the second server can be called the second identification of the first device. Similarly, after the second device registers with the second server, it can obtain the device identification assigned to the second device by the second server, and the device identification assigned to the second device by the second server can be called the second identification of the second device.

[0088] In some embodiments, for any one of the first device and the second device, if the device logs out of the account, or if the far-field message switch in the device is switched from the on state to the off state, the device can be deregistered on the first server and deregistered on the second server.

[0089] Optionally, when the device logs out of the account, the device can automatically switch its own far-field message switch from an on state to an off state. Alternatively, the user can manually switch the far-field message switch in the device from an on state to an off state.

[0090] If the device logs out of the account, or if the far-field messaging switch in the device is switched from on to off, it means that the device currently does not support the far-field messaging capability. Therefore, the device can be deregistered on the first server and deregistered on the second server to turn off the far-field messaging capability.

[0091] Combined with the above Figures 2 to 4 The system architecture described in the embodiment is used to exemplarily illustrate the device registration process and the device deregistration process:

[0092] See also Figure 7 In the case of a short-distance communication connection between the first device and the second device, after the first device and the second device complete account synchronization or same-account authentication, both the first device and the second device log in to the account.

[0093] The management module in the first device or the second device can register the device on the first server and register the device on the second server when the account on the device has been logged in, or when the account on the device has been logged in and privacy authorization has been performed, or when the account on the device has been logged in and the far-field message switch on the device is turned on, or when the account on the device has been logged in and privacy authorization has been performed and the far-field message switch on the device is turned on.

[0094] Specifically, the management module can call the first interface (also called the device cloud interface) provided by the first server to register the device on the first server to obtain a first identifier assigned by the first server, and call the second interface (also called the service cloud interface) provided by the second server to register the device on the second server to obtain a second identifier assigned by the second server, and save the first identifier and the second identifier locally as registration information.

[0095] In a possible implementation, the first device and the second device are further provided with an account module, and the account module is used to log in to an account. Figure 8 As shown, after the account module logs in the account server, it can obtain the account name (also known as userid) and verification code (including but not limited to code, token, etc.) sent by the account server. After the account login is successful, the account module can broadcast a successful login message in the device, and the successful login message carries the account name. After the management module receives the successful login message, it can obtain the verification code from the account module. After that, the management module can send a device registration request message carrying the account name, the verification code, and the device identification code of the device (including but not limited to the media access control (MAC) address, product serial number (SN), unique device identifier (UDID), universally unique identifier (UUID), etc.) to both the first server and the second server. After the first server receives the device registration request message, it can perform an account verification on the account server according to the account name and the verification code. If the account verification passes, the device is registered, and a first identifier is assigned, and the first identifier is sent to the management module. After receiving the device registration request message, the second server can perform account verification on the account server according to the account name and the verification code. If the account verification passes, the device is registered, a second identifier is allocated, and the second identifier is sent to the management module.

[0096] See also Fig. 9The management module in the first device or the second device can deregister the device on the first server and deregister the device on the second server when the device logs out of the account, or when the privacy authorization is revoked in the device, or when the far-field message switch in the device is switched from the on state to the off state.

[0097] Specifically, the management module may call a first interface provided by the first server to perform device deregistration on the first server, and call a second interface provided by the second server to perform device deregistration on the second server, and then clear the registration information stored locally.

[0098] Step 603: The short-range communication connection between the first device and the second device is disconnected.

[0099] In some cases, when the first device is too far away from the second device, the short-range communication connection between the first device and the second device will be automatically disconnected.

[0100] For example, assuming that the short-range communication connection is a Bluetooth connection, the first device is a mobile phone, and the second device is a smart watch. If the user only wears a smart watch without a mobile phone when exercising outdoors, the Bluetooth connection between the mobile phone and the smart watch will be automatically disconnected because the distance between the mobile phone and the smart watch is too far.

[0101] In other cases, the disconnection of the short-range communication connection between the first device and the second device may be triggered by a user.

[0102] For example, assuming that the short-range communication connection is a Bluetooth connection, if the user turns off the Bluetooth switch in the first device and / or the second device, the Bluetooth connection between the first device and the second device will be disconnected.

[0103] In some embodiments, after the short-distance communication connection between the first device and the second device is disconnected, the wearable device in the first device and the second device can directly establish a long connection with the first server. That is, when the wearable device switches from the near field to the far field, it will actively go online in the far field.

[0104] In some embodiments, after the short-distance communication connection between the first device and the second device is disconnected, the terminals in the first device and the second device may establish a long connection with the first server, or the terminals may establish a short connection with the first server, or the terminals may not establish a communication connection with the first server.

[0105] In the embodiment of the present application, the terminal does not need to directly establish a long connection with the first server after the short-distance communication connection between the terminal and the wearable device is disconnected, thereby saving power consumption of the terminal.

[0106] For example, the terminals in the first device and the second device can establish a long connection with the first server when multiple functions included in the smart interconnection function are switched between the on state and the off state. For example, the smart interconnection function includes the application continuation function, the call sharing function, the notification sharing function, the keyboard and mouse sharing function, etc. When any of these functions is switched from the on state to the off state, or from the off state to the on state, the terminal can establish a long connection with the first server, and this long connection can be disconnected after a certain period of time.

[0107] Step 604: After the short-distance communication connection between the first device and the second device is disconnected, if the first device determines through the first server that the second device is online, the first device and the second device are networked.

[0108] The first device determines that the second device is online through the first server, which means that the first device realizes the far-field discovery of the second device. Therefore, the first device can be networked with the second device, so that the first device and the second device can subsequently perform far-field message synchronization.

[0109] For any one of the first device and the second device, the device being online means that the device has established a communication connection with the first server, and the device being offline means that the communication connection between the device and the first server is disconnected, that is, the device being offline means that the device has not established a communication connection with the first server.

[0110] In some embodiments, the first device may obtain a device list from the first server, the device list including the online and offline status of each device among all devices registered with the first server and having the same account as the first device, that is, the device list includes the online and offline status of the second device. The online and offline status of a device is used to indicate whether the device is currently online or offline. For example, the first device may obtain the device list from the first server after restarting.

[0111] In some embodiments, if the second device establishes a communication connection with the first server, the first server determines that the second device is online and sends a device online notification message to the first device, where the device online notification message is used to indicate that the second device is online.

[0112] In some embodiments, if the communication connection between the second device and the first server is disconnected, the first server determines that the second device is offline and sends a device offline notification message to the first device, where the device offline notification message is used to indicate that the second device is offline.

[0113] In this way, the first device can timely learn the online and offline status of the second device by pulling the device list or receiving the device online notification message or device offline notification message sent by the first server. In this way, it is convenient for the first device to network with the online second device in time.

[0114] In one possible manner, when the second device establishes a short-distance communication connection with the first device, it will actively disconnect the communication connection with the first server, and the first server can determine that the second device is offline. That is, when the second device switches from far field to near field, it will actively go offline in the far field.

[0115] In another possible manner, a network anomaly may occur between the second device and the first server, which may cause the communication connection between the second device and the first server to be disconnected. For example, after the second device establishes a long connection with the first server, the second device periodically sends a heartbeat message to the first server to keep the long connection alive. In this case, if the first server times out and does not receive the heartbeat message from the second device, the first server may determine that the second device is offline.

[0116] For example, the long connection between the first device or the second device and the first server can be a communication connection established based on the message queuing telemetry transport protocol (MQTT). In this case, the first device and / or the second device can subscribe to the device online and offline topic in the first server. If the first server determines that one of the first device and the second device is online, it will generate a device online notification message belonging to the device online topic, and the device online notification message is used to indicate that the device is online. The first server can send the device online notification message to another device. If the first server determines that one of the first device and the second device is offline, it will generate a device offline notification message belonging to the device offline topic, and the device online notification message is used to indicate that the device is offline. The first server can send the device offline notification message to another device.

[0117] Combined with the above Figures 2 to 4 The system architecture described in the embodiment is used to exemplarily illustrate the device online process and the device offline process:

[0118] See also Fig.10 In the first possible scenario, the management module in the terminal can actively pull a device list from the first server, where the device list includes the online and offline status of each device in all devices registered with the first server and with the same account as the terminal. For example, the management module in the terminal can actively obtain the device list from the first server after the terminal is restarted.

[0119] In a second possible scenario, the management module in the terminal may subscribe to a device online and offline topic in the first server.

[0120] In this case, if the wearable device establishes a long connection with the first server, the first server determines that the wearable device is online. Afterwards, the first server directly sends a device online notification message indicating that the wearable device is online to the management module in the terminal when the first server establishes a communication connection with the terminal; if the first server does not establish a communication connection with the terminal, the first server sends a device online notification message indicating that the wearable device is online to the third server, and the third server sends the device online notification message to the management module in the terminal.

[0121] If the long connection between the wearable device and the first server is disconnected, the first server determines that the wearable device is offline. Afterwards, the first server directly sends a device offline notification message indicating that the wearable device has been offline to the management module in the terminal when the first server establishes a communication connection with the terminal; the first server sends a device offline notification message indicating that the wearable device has been offline to the third server when the first server does not establish a communication connection with the terminal, and the third server sends the device offline notification message to the management module in the terminal.

[0122] In the third possible scenario, after the first server establishes a long connection with the wearable device, if the first server times out without receiving the heartbeat message of the wearable device, it can be determined that the wearable device is offline. Afterwards, the first server directly sends a device offline notification message indicating that the wearable device has gone offline to the management module in the terminal when the first server establishes a communication connection with the terminal; the first server sends a device offline notification message indicating that the wearable device has gone offline to the third server when the first server does not establish a communication connection with the terminal, and the third server sends the device offline notification message to the management module in the terminal.

[0123] Through the above three possible situations, the management module in the terminal can determine whether the online and offline status of the wearable device has changed. When the online and offline status of the wearable device is switched from offline to online, that is, when the wearable device is newly online, the terminal can initiate networking with the wearable device. When the online and offline status of the wearable device is switched from online to offline, the terminal can cancel the networking with the wearable device.

[0124] The above describes the process of the terminal sensing the online and offline status of the wearable device. The following describes the process of the wearable device sensing the online and offline status of the terminal:

[0125] In the first possible scenario, the management module in the wearable device can actively pull a device list from the first server, where the device list includes the online and offline status of each device among all devices registered on the first server and with the same account as the wearable device. For example, the management module in the wearable device can actively obtain the device list from the first server after the wearable device is restarted.

[0126] In a second possible scenario, the management module in the wearable device may subscribe to a device online and offline topic in the first server.

[0127] In this case, if the terminal establishes a communication connection with the first server, the first server determines that the terminal is online. The first server can send a device online notification message indicating that the terminal is online to the management module in the wearable device.

[0128] If the communication connection between the terminal and the first server is disconnected, the first server determines that the terminal is offline. The first server can send a device offline notification message indicating that the terminal has been offline to the management module in the wearable device.

[0129] In the third possible scenario, after the first server establishes a persistent connection with the terminal, if the first server times out without receiving a heartbeat message from the terminal, it can be determined that the terminal is offline. The first server can send a device offline notification message indicating that the terminal has gone offline to the management module in the wearable device.

[0130] Through the above three possible situations, the management module in the wearable device can determine whether the online and offline status of the terminal has changed. When the online and offline status of the terminal is switched from offline to online, that is, when the terminal is newly online, the wearable device can initiate networking with the terminal. When the online and offline status of the terminal is switched from online to offline, the wearable device can cancel the networking with the terminal.

[0131] In some embodiments, if the first device determines through the first server that the second device is online, then when the second device is a designated device, the first device and the second device are networked. The designated device is the device that the first device focuses on. For example, the designated device can be the device that the target application in the first device sets as the device of its concern. For example, the designated device can be the last device that establishes a short-range communication connection with the first device. Of course, the designated device can also be a device selected by the user from all devices that have been paired with the first device. This is not limited in the embodiments of the present application. In addition, the designated device can also be a device that supports far-field networking.

[0132] Optionally, the operation of networking the first device and the second device may be: the first device sends a device authentication request message to the second device through the first server. After the second device receives the device authentication request message, it sends a confirmation message for the device authentication request message to the first device through the first server. After the first device receives the confirmation message sent by the second device, it performs the same account authentication with the second device. After completing the same account authentication with the second device, the first device sends a networking request message to the second device through the first server. After the second device receives the networking request message, it sends a confirmation message for the networking request message to the first device through the first server.

[0133] In this way, the first device and the second device perform far-field networking only after performing same account authentication, thereby ensuring data security when the first device and the second device perform far-field message synchronization subsequently.

[0134] The device authentication request message sent by the first device to the second device is used to request device authentication. The device authentication request message carries an authentication method supported by the first device (including but not limited to same account authentication method, etc.).

[0135] After the second device receives the device authentication request message, if it supports the authentication method carried in the device authentication request message, it can return a confirmation message to the first device. The confirmation message carries the authentication method supported by the second device (including but not limited to the same account authentication method, etc.). The confirmation message is used to indicate that the second device has received the device authentication request message and supports the authentication method carried in the device authentication request message.

[0136] The networking request message sent by the first device to the second device is used to request networking with the second device. The networking request message may carry networking information of the first device, and the networking information of the first device may include the first identifier and the second identifier of the first device.

[0137] The confirmation message returned by the second device to the first device for the networking request message is used to confirm networking with the first device. The confirmation message may carry networking information of the second device, and the networking information of the second device may include the first identifier and the second identifier of the second device.

[0138] In some embodiments, the first device and the second device will negotiate a key during the same-account authentication process. After the first device and the second device complete the same-account authentication, the first device and the second device can use the key to exchange networking information. That is, the first device can use the key to encrypt and transmit a networking request message to the second device, and the networking request message carries the first identifier and the second identifier of the first device. After the second device receives the networking request message, it can use the key to decrypt the networking request message to obtain the first identifier and the second identifier of the first device, and then the second device can use the key to encrypt and transmit a confirmation message for the networking request message to the first device, and the confirmation message carries the first identifier and the second identifier of the second device. After the first device receives the confirmation message, it can use the key to decrypt the confirmation message to obtain the first identifier and the second identifier of the second device. In this way, the first device completes the far-field networking with the second device.

[0139] Combined with the above Figures 2 to 4 The system architecture described in the embodiment is used to exemplarily illustrate the device networking process:

[0140] As an example, see Fig.11 , the target application in the terminal can register the device online and offline monitoring in the management module in the terminal to monitor the online and offline status of the wearable device. The management module in the terminal can determine that the monitored wearable device is online and needs to be networked with the wearable device by pulling the device list from the first server or receiving the device online notification message sent by the first server or the third server.

[0141] Specifically, after the wearable device is online, if the terminal determines that the wearable device needs to be authenticated, the management module in the terminal establishes a long connection with the first server without establishing a communication connection with the first server, and then sends a device authentication request message to the wearable device through the first server. After the management module in the wearable device receives the device authentication request message, it sends a confirmation message for the device authentication request message to the terminal through the first server. After the management module in the terminal receives the confirmation message sent by the wearable device, it performs the same account authentication with the wearable device. For example, the management module in the terminal and the management module in the wearable device can perform the same account authentication through the trust ring module in the terminal and the trust ring module in the wearable device. After completing the same account authentication with the wearable device, the management module in the terminal exchanges networking information with the wearable device through the first server. After completing the networking information exchange, the management module in the terminal determines that the wearable device is successfully authenticated, and calls back the wearable device to the target application in the terminal through the listener previously registered by the target application in the terminal.

[0142] In some embodiments, the target application in the wearable device can register the device online and offline monitoring in the management module in the wearable device to monitor the online and offline status of the terminal. After the wearable device completes the exchange of networking information with the terminal, the management module in the wearable device can determine that the terminal authentication is successful, and then the target application in the wearable device can call back the terminal online through the listener previously registered by the target application in the wearable device.

[0143] In some embodiments, if the terminal or wearable device finds that the device authentication has timed out during the device authentication process, it is determined that the device authentication has failed.

[0144] As another example, see Fig.12 , the target application in the wearable device can register the device online and offline monitoring in the management module in the wearable device to monitor the online and offline status of the terminal. The management module in the wearable device can determine that the monitored terminal is online and needs to be networked with the terminal by pulling the device list from the first server or receiving the device online notification message sent by the first server.

[0145] Specifically, after the terminal goes online, if the wearable device determines that the terminal needs authentication, the management module in the wearable device sends a device authentication request message to the first server. After the first server receives the device authentication request message, if it is determined that the first server has established a communication connection with the terminal, the device authentication request message is directly sent to the terminal. If it is determined that the first server has not established a communication connection with the terminal, the device authentication request message is sent to the third server, and the third server sends the device authentication request message to the terminal. After the management module in the terminal receives the device authentication request message, if the terminal has established a communication connection with the first server, a confirmation message for the device authentication request message is sent to the wearable device through the first server; if the terminal has not established a communication connection with the first server, a long connection is first established with the first server, and then a confirmation message for the device authentication request message is sent to the wearable device through the first server. After receiving the confirmation message sent by the terminal, the management module in the wearable device performs the same account authentication with the terminal. For example, the management module in the wearable device and the management module in the terminal can perform the same account authentication through the trust ring module in the wearable device and the trust ring module in the terminal. After completing the same account authentication with the terminal, the management module in the wearable device exchanges networking information with the terminal through the first server. After completing the networking information exchange, the management module in the wearable device determines that the terminal authentication is successful, and calls back the terminal to the target application in the wearable device through the listener previously registered by the target application in the wearable device.

[0146] In some embodiments, the target application in the terminal can register the device online and offline monitoring in the management module in the terminal to monitor the online and offline status of the wearable device. After the terminal completes the exchange of networking information with the wearable device, the management module in the terminal can determine that the wearable device authentication is successful, and then can call back the wearable device online to the target application in the terminal through the listener previously registered by the target application in the terminal.

[0147] In some embodiments, if the wearable device or terminal finds that the device authentication has timed out during the device authentication process, it is determined that the device authentication has failed.

[0148] In a possible implementation, the target application's application interface can display the current online and offline status of each device among all devices that have been paired with the device. Therefore, the target application needs to sense whether the device it is concerned about is online. Generally, the target application is relatively concerned about whether the device is online when it is running in the foreground.

[0149] To this end, after the first device and the second device complete networking, if the first device detects that the target application in the first device enters the foreground, a unilateral periodic heartbeat task message is sent to the second device through the first server. The unilateral periodic heartbeat task message is used to instruct the second device to periodically send a heartbeat message (also called a unilateral heartbeat message) to the first device within a first preset time. In this way, the first device can timely perceive the online and offline status of the second device when the target application is running in the foreground.

[0150] After the second device receives the unilateral periodic heartbeat task message sent by the first device, it can periodically send heartbeat messages to the first device within the first preset time after receiving the unilateral periodic heartbeat task message, and stop sending heartbeat messages to the first device after the first preset time after receiving the unilateral periodic heartbeat task message. That is, after the second device receives the unilateral periodic heartbeat task message, it can execute the unilateral periodic heartbeat task, and the unilateral periodic heartbeat task is used to periodically send heartbeat messages to the first device, and the unilateral periodic heartbeat task ends after the first preset time. Since the unilateral periodic heartbeat task is that the second device periodically sends a heartbeat message to the first device, and the first device does not need to return a heartbeat response to the second device, the power consumption of the first device can be saved.

[0151] In some embodiments, within a first preset time period after the first device sends a unilateral periodic heartbeat task message to the second device, if the target application in the first device exits the foreground, or if the first device switches to a screen-off state, the first device sends a unilateral periodic heartbeat task stop message to the second device through the first server.

[0152] After the second device receives the unilateral periodic heartbeat task stop message sent by the first device, it can end the unilateral periodic heartbeat task and no longer send heartbeat messages to the first device.

[0153] In some embodiments, within a first preset time period after the first device sends a unilateral periodic heartbeat task message to the second device, if the target application in the first device continues to run in the foreground and the first device has not switched to a screen-off state, the first device may send a unilateral periodic heartbeat task message to the second device again after the first preset time period after sending the unilateral periodic heartbeat task message to the second device. In this way, the second device may continue to periodically send heartbeat messages to the first device.

[0154] During the execution of the unilateral periodic heartbeat task, if the first device times out and fails to receive the heartbeat message sent by the second device, the first device may determine that the second device is offline.

[0155] For example, the heartbeat period indicated by the unilateral periodic heartbeat task is smaller than the heartbeat period for the first server to perceive the online and offline status of the second device. That is, the period for the second device to send heartbeat messages to the first device is smaller than the period for the second device to send heartbeat messages to the first server, wherein the heartbeat message sent by the second device to the first server is used to keep the long connection between the second device and the first server alive. In this way, when the target application in the first device is running in the foreground, the first device can quickly perceive the online and offline status of the second device.

[0156] For example, the heartbeat cycle of the first server to sense the online and offline status of the second device is 15 minutes. The heartbeat cycle indicated by the unilateral periodic heartbeat task is 30 seconds. In this case, if there is no unilateral periodic heartbeat task, it takes 15 minutes for the first device to sense whether the second device is offline. In the case of a unilateral periodic heartbeat task, the first device only needs 30 seconds to sense whether the second device is offline.

[0157] Combined with the above Figures 2 to 4 The system architecture described in the embodiment is used to exemplarily illustrate the device networking heartbeat process:

[0158] See also Fig.13 When the target application in the terminal enters the foreground, the management module in the terminal sends a unilateral periodic heartbeat task message to the wearable device through the first server. After the wearable device receives the unilateral periodic heartbeat task message sent by the terminal, it starts the unilateral periodic heartbeat task. For example, the unilateral periodic heartbeat task can be to send a unilateral heartbeat message to the terminal through the first server every 30 seconds within 5 minutes.

[0159] In the first possible scenario, if the terminal turns off the screen, the management module in the terminal can send a unilateral periodic heartbeat task stop message to the wearable device. After receiving the unilateral periodic heartbeat task stop message sent by the terminal, the wearable device stops the unilateral periodic heartbeat task and no longer sends unilateral heartbeat messages to the terminal.

[0160] In the second possible situation, if the target application in the terminal exits the foreground operation, the management module in the terminal can send a unilateral periodic heartbeat task stop message to the wearable device. After receiving the unilateral periodic heartbeat task stop message sent by the terminal, the wearable device stops the unilateral periodic heartbeat task and no longer sends unilateral heartbeat messages to the terminal.

[0161] In some embodiments, the communication connection between the first server and the terminal may be disconnected. For example, the terminal may actively disconnect the communication connection with the first server; or the first server may sense that the heartbeat of the terminal has timed out when establishing a long connection with the terminal and determine that the communication connection between the first server and the terminal is disconnected. In this case, the first server may determine that the terminal is offline, and then send an observer offline message to the wearable device.

[0162] If the wearable device receives the observer offline message sent by the first server, it can stop the unilateral periodic heartbeat task and no longer send unilateral heartbeat messages to the terminal. In some special cases, if the observer offline message sent by the first server to the wearable device is lost, the wearable device needs to wait for the unilateral periodic heartbeat task to be completed before automatically stopping.

[0163] Step 605: After the first device completes networking with the second device, the first device creates a session between the first device and the second device through the second server, and sends the target message in the first device to the second device through the session.

[0164] The target message is a message that needs to be synchronized to the second device. For example, the target message may be a message generated by a target application.

[0165] The session between the first device and the second device is used to implement message interaction between the first device and the second device. The session can also be called a service channel. Optionally, after the second server creates the session between the first device and the second device, it can also monitor the busyness of the session. If the busyness of the session is low, for example, there is no data transmission in the session within the second preset time, the second server can close the session.

[0166] Optionally, the operation of the first device creating a session between the first device and the second device through the second server may be: if the first device generates a target message, the first device sends a session creation notification message to the second device through the first server. After the second device receives the session creation notification message sent by the first device, it sends a confirmation message for the session creation notification message to the first device through the first server, and sends a session creation request message to the second server. If the first device receives the confirmation message for the session creation notification message sent by the second device, it sends a session creation request message to the second server. After the second server receives the session creation request message sent by the first device and the session creation request message sent by the second device, it creates a session between the first device and the second device, and sends a session creation success message to both the first device and the second device. Both the first device and the second device receive the session creation success message sent by the second server.

[0167] In this way, the first device can instruct the second device to create a session through the first server, and then both the first device and the second device can request the second server to create a session. In this case, the second server will create a session between the first device and the second device, thereby ensuring the data security of the created session.

[0168] The session creation notification message sent by the first device to the second device is used to instruct the second device to create a session. The session creation notification message may carry the first identifier of the first device and the first identifier of the second device, and is used to instruct the second device identified by the first identifier of the second device to create a session with the first device identified by the first identifier of the first device. Optionally, the session creation notification message may also carry the type of session to be created, which includes but is not limited to notification type sessions, audio type sessions, video type sessions, etc., which are not limited in the embodiments of the present application.

[0169] After the first server receives the session creation notification message, it determines that the first device identified by the first identifier of the first device and the second device identified by the first identifier of the second device are both devices registered in the first server. The first server can send the session creation notification message to the second device identified by the first identifier of the second device.

[0170] After the second device receives the session creation notification message, it can obtain the second identifier of the first device associated with the first identifier of the first device from the networking information of the first device. Afterwards, the second device can return a confirmation message for the session creation notification message to the first device through the first server, and the confirmation message is used to confirm the creation of the session. In addition, the second device can send a session creation request message to the second server, and the session creation request message carries the second identifier of the second device and the second identifier of the first device. The session creation request is used to indicate that the second device identified by the second identifier of the second device requests to create a session with the first device identified by the second identifier of the first device. In addition, the session creation request can also carry the type of session to be created, and the session type carried in the session creation request is the same as the session type carried in the session creation notification message.

[0171] After the first device receives the confirmation message for the session creation notification message sent by the second device, it can send a session creation request message to the second server, the session creation request message carries the second identifier of the first device and the second identifier of the second device, and the session creation request is used to indicate that the first device identified by the second identifier of the first device requests to create a session with the second device identified by the second identifier of the second device. In addition, the session creation request can also carry the type of session to be created, and the session type carried in the session creation request is the same as the session type carried in the session creation notification message.

[0172] If the second server receives a session creation request message sent by the first device within the third preset time period after receiving the session creation request message sent by the second device, or if the second server receives a session creation request message sent by the second device within the third preset time period after receiving the session creation request message sent by the first device, the second server can determine whether the session to be created by the session creation request message sent by the first device is the same as the session to be created by the session creation request message sent by the second device. If the session to be created by the session creation request message sent by the first device is the same as the session to be created by the session creation request message sent by the second device, that is, both are to create a session between the first device and the second device, and the type of session to be created is also the same, then the second server can create a session between the first device and the second device according to the session type, and after the session creation is completed, send a session creation success message to both the first device and the second device. Subsequently, the first device and the second device can use the session to synchronize messages to the other end.

[0173] Combined with the above Figures 2 to 4 The system architecture described in the embodiment is used to exemplarily illustrate the session creation process:

[0174] As an example, see Fig.14, the target application in the terminal registers a session listener in the management module in the terminal, and the target application in the terminal instructs the management module in the terminal to create a session. For example, after generating a target message, the target application in the terminal can instruct the management module in the terminal to create a session. The management module in the terminal directly sends a session creation notification message to the first server when the terminal establishes a communication connection with the first server. When the terminal does not establish a communication connection with the first server, the management module in the terminal first establishes a long connection with the first server, and then sends a session creation notification message to the first server. The first server sends the session creation notification message to the wearable device. After receiving the session creation notification message, the management module in the wearable device replies to the terminal through the first server with a confirmation message for the session creation notification message, and sends a session creation request message to the second server. After receiving the confirmation message, the terminal sends a session creation request message to the second server. After receiving the session creation request message sent by the terminal and the session creation request message sent by the wearable device, the second server determines that both the terminal and the wearable device need to establish a session with each other, and then establishes a session between the terminal and the wearable device. After the session is established, the second server sends a session creation success message to both the terminal and the wearable device. After receiving the session creation success message sent by the second server, the management module in the terminal and the management module in the wearable device perform session negotiation, wherein the session negotiation involves negotiation of session keys, transmission performance (including but not limited to bandwidth, maximum transmission data volume of service channels, etc.), and capabilities of both ends (including but not limited to transmission delay, etc.).

[0175] After the session negotiation is completed, the management module in the terminal can call back the session opening to the target application in the terminal through the listener previously registered by the target application in the terminal. In some embodiments, the target application in the wearable device can also register a session listener in the management module in the wearable device. In this case, after the session negotiation is completed, the management module in the wearable device can call back the session opening to the target application in the wearable device through the listener previously registered by the target application in the wearable device. After the session negotiation is completed, the terminal and the wearable device can use the session to synchronize messages. For example, the target application in the terminal can use the session to send the generated target message to the wearable device.

[0176] In some embodiments, if the management module in the terminal finds that the session creation has timed out, the session creation failure can be called back to the target application in the terminal through a listener previously registered by the target application in the terminal.

[0177] As another example, see Fig.15, the target application in the wearable device registers a session monitor in the management module in the wearable device, and the target application in the wearable device instructs the management module in the wearable device to create a session. For example, after generating a target message, the target application in the wearable device can instruct the management module in the wearable device to create a session. The management module in the wearable device sends a session creation notification message to the first server. The first server directly sends the session creation notification message to the terminal when a communication connection is established with the terminal, and the first server sends the session creation notification message to the third server when a communication connection is not established with the terminal, and the third server sends the session creation notification message to the terminal. After receiving the session creation notification message, the management module in the terminal replies to the wearable device through the first server with a confirmation message for the session creation notification message when the terminal establishes a communication connection with the first server, and first establishes a long connection with the first server when the terminal does not establish a communication connection with the first server, and then replies to the wearable device with a confirmation message for the session creation notification message through the first server, and the management module in the terminal sends a session creation request message to the second server. After receiving the confirmation message, the wearable device sends a session creation request message to the second server. After receiving the session creation request message sent by the terminal and the session creation request message sent by the wearable device, the second server determines that both the terminal and the wearable device need to establish a session with each other, and then establishes a session between the terminal and the wearable device. After the session is established, the second server sends a session creation success message to both the terminal and the wearable device. After receiving the session creation success message sent by the second server, the management module in the terminal and the management module in the wearable device perform session negotiation.

[0178] After the session negotiation is completed, the management module in the wearable device can call back the session opening to the target application in the wearable device through the listener previously registered by the target application in the wearable device. In some embodiments, the target application in the terminal can also register a session listener in the management module in the terminal. In this case, after the session negotiation is completed, the management module in the terminal can call back the session opening to the target application in the terminal through the listener previously registered by the target application in the terminal. After the session negotiation is completed, the wearable device and the terminal can use the session to synchronize messages. For example, the target application in the wearable device can use the session to send the generated target message to the terminal.

[0179] In some embodiments, if the management module in the wearable device finds that the session creation has timed out, the session creation failure can be called back to the target application in the wearable device through a listener previously registered by the target application in the wearable device.

[0180] As yet another example, see Fig.16 ,The target application will actively close the session in some scenarios.

[0181] In the first possible scenario, the session can be actively closed by the wearable device. In this case, the target application in the wearable device can register a session listener in the management module in the wearable device, and the target application in the wearable device can instruct the management module in the wearable device to close the session when the session needs to be closed. The management module in the wearable device sends a session closing message to the second server, and the second server sends a session closing message to the terminal. After the session is successfully closed, the management module in the wearable device can return the session closing success to the target application in the wearable device through the listener previously registered by the target application in the wearable device. In some embodiments, the target application in the terminal can also register a session listener in the management module in the terminal. In this case, after the session is successfully closed, the management module in the terminal can call back the target application in the terminal through the listener previously registered by the target application in the terminal to indicate that the session is closed.

[0182] In the second possible scenario, the terminal can actively close the session. In this case, the target application in the terminal can register a session listener with the management module in the terminal, and the target application in the terminal can instruct the management module in the terminal to close the session when the session needs to be closed. The management module in the terminal sends a session closing message to the second server, and the second server sends a session closing message to the wearable device. After the session is successfully closed, the management module in the terminal can return the session closing success to the target application in the terminal through the listener previously registered by the target application in the terminal. In some embodiments, the target application in the wearable device can also register a session listener with the management module in the wearable device. In this case, after the session is successfully closed, the management module in the wearable device can call back the target application in the wearable device through the listener previously registered by the target application in the wearable device to inform that the session is closed.

[0183] In some embodiments, multiple terminals can be paired with a wearable device. In this case, only one of the multiple terminals can be paired with the wearable device at the same time. Fig.17 To illustrate this process:

[0184] See also Fig.17 , terminal A and terminal B have the same account as the wearable device.

[0185] (1) Terminal A is connected to the wearable device in a far field.

[0186] Specifically, terminal A can first establish a near-field connection with the wearable device to achieve operations such as device pairing, account synchronization, same-account authentication, and device registration. Afterwards, the target application in terminal A can set the device of interest to be the wearable device. In this case, if the near-field connection between terminal A and the wearable device is disconnected, the management module in terminal A can establish a far-field network with the wearable device after the wearable device goes online in the far field.

[0187] (2) The wearable device is connected to terminal B.

[0188] Specifically, the wearable device is connected to the terminal B in a near field connection to implement operations such as device pairing, account synchronization, same account authentication, device registration, etc. For example, the near field connection between the management module in the terminal B and the wearable device can be triggered by a target application in the terminal B.

[0189] After the wearable device is connected to the terminal B in the near field, the wearable device will be offline in the far field. In this case, the management module and the target application in the terminal A both sense that the wearable device is offline in the far field.

[0190] After the near-field connection between terminal B and the wearable device is disconnected, the wearable device goes online in the far field, and the management module in terminal B can form a far-field network with the wearable device. Optionally, the management module in terminal B can also notify the target application in terminal B that the wearable device goes online in the far field.

[0191] (3) After the wearable device goes online in the far field, terminal A initiates far-field networking with the wearable device.

[0192] Specifically, after the wearable device goes online in the far field, the management module in terminal A senses that the wearable device goes online in the far field, and then initiates far-field networking with the wearable device. For example, the management module in terminal A can send a networking request message carrying the device identification code of terminal A to the wearable device. After the wearable device receives the networking request message sent by terminal A, it can determine whether terminal A is the latest terminal to pair with the wearable device based on the device identification code carried in the networking request message. If not, the networking request of terminal A is rejected, that is, a rejection message for the networking request message is sent to terminal A. After receiving the rejection message for the networking request message, terminal A can clear the networking relationship between terminal A and the wearable device. Among them, terminal A clearing the networking relationship with the wearable device means that terminal A no longer actively initiates far-field networking with the wearable device when it senses that the wearable device goes online in the far field. In some cases, the management module in terminal A initiates far-field networking with the wearable device only when the target application in terminal A triggers far-field networking with the wearable device in the management module in terminal A.

[0193] In some embodiments, the target application in the terminal only synchronizes messages with one wearable device at a time, but it can add multiple wearable devices. In this case, it is necessary to set the wearable device that the target application in the terminal pays most attention to. Once this wearable device is online, far-field networking is initiated, while other wearable devices are online. Fig.18 To illustrate this process:

[0194] See also Fig.18 , the terminal, wearable device A and wearable device B have the same account.

[0195] (1) The terminal is connected to wearable device A in the far field.

[0196] Specifically, the terminal can first establish a near-field connection with wearable device A to achieve operations such as device pairing, account synchronization, same-account authentication, and device registration. Afterwards, the target application in the terminal can set the device of interest to wearable device A. In this case, if the near-field connection between the terminal and wearable device A is disconnected, after wearable device A goes online in the far field, the management module in the terminal can establish a far-field network with wearable device A. After the far-field networking is completed, the management module in the terminal can notify the target application in the terminal that wearable device A is online in the far field.

[0197] (2) The terminal switches to wearable device B.

[0198] Specifically, the terminal can first establish a near-field connection with wearable device B to achieve operations such as device pairing, account synchronization, same-account authentication, and device registration. Afterwards, the target application in the terminal can switch the device of interest from wearable device A to wearable device B. In this case, if the terminal is conducting far-field networking with wearable device A, the management module in the terminal disconnects the far-field networking with wearable device A, and notifies the target application in the terminal that wearable device A is offline in the far field. Afterwards, if the near-field connection between the terminal and wearable device B is disconnected, after wearable device B is online in the far field, the management module in the terminal can establish a far-field network with wearable device B. After completing the far-field networking, the management module in the terminal can notify the target application in the terminal that wearable device B is online in the far field.

[0199] (3) The terminal is connected to wearable device B in near field.

[0200] Specifically, the target application in the terminal can instruct the management module in the terminal to establish a near-field connection with the wearable device B. In this case, the management module in the terminal notifies the target application in the terminal that the wearable device B is offline in the far field, and then establishes a near-field connection with the wearable device B, at which time the wearable device B is online in the near field.

[0201] In an embodiment of the present application, one of the first device and the second device is a terminal and the other is a wearable device. After the first device and the second device establish a short-distance communication connection, the first device registers the device on the first server and registers the device on the second server. After the short-distance communication connection between the first device and the second device is disconnected, if the first device determines that the second device is online through the first server, the first device and the second device are networked. After the first device and the second device complete the networking, the first device creates a session between the first device and the second device through the second server, and sends the target message in the first device to the second device through the session. In this way, the terminal and the wearable device can realize the far-field online perception and far-field networking of the terminal and the wearable device by registering the device in the first server and the second server, and then the session between the terminal and the wearable device can be established through the second server, and the far-field message interaction between the terminal and the wearable device can be realized through the session. In this case, no matter how far the terminal and the wearable device are apart, the message synchronization between the terminal and the wearable device can be realized in time, so that the user can know the message he cares about in time, which greatly facilitates the user's use.

[0202] Fig.19 is a structural diagram of a message sending device provided in an embodiment of the present application. The device can be implemented by software, hardware, or a combination of both to become part or all of the first device. One of the first device and the second device can be as follows Fig. 20 The terminal described in the embodiment, another one can be as follows Fig.21 The wearable device described in the embodiment. Fig.19 The device includes: a device registration module 1901, a networking module 1902 and a sending module 1903.

[0203] The device registration module 1901 is used to register the device on the first server and register the device on the second server after the first device establishes a short-distance communication connection with the second device;

[0204] The networking module 1902 is used to establish a network with the second device if it is determined through the first server that the second device is online after the short-distance communication connection between the first device and the second device is disconnected;

[0205] The sending module 1903 is used to create a session between the first device and the second device through the second server after completing the networking with the second device, and send the target message in the first device to the second device through the session.

[0206] Optionally, the device registration module 1901 is used to:

[0207] After the first device establishes a short-range communication connection with the second device, synchronizing an account with the second device;

[0208] After completing the account synchronization with the second device, if it is detected that the far-field message switch is switched from the off state to the on state, the device is registered on the first server, and the service channel is registered on the second server.

[0209] Optionally, the device further comprises:

[0210] The device deregistration module is used to deregister the device on the first server and deregister the device on the second server if the first device logs out of the account, or if the far-field message switch is switched from the on state to the off state.

[0211] Optionally, the device further comprises:

[0212] An acquisition module, used to acquire a device list from the first server, where the device list includes the online and offline status of the second device;

[0213] and / or,

[0214] A receiving module, used to receive a device online notification message sent by the first server, where the device online notification message is used to indicate that the second device has come online;

[0215] and / or,

[0216] The receiving module is used to receive a device offline notification message sent by the first server, where the device offline notification message is used to indicate that the second device has gone offline.

[0217] Optionally, the networking module 1902 is used to:

[0218] Sending a device authentication request message to the second device through the first server;

[0219] If a confirmation message for the device authentication request message returned by the second device is received, performing same-account authentication with the second device;

[0220] After completing the same account authentication with the second device, sending a networking request message to the second device through the first server;

[0221] Receive a confirmation message returned by the second device for the networking request message.

[0222] Optionally, the device further comprises:

[0223] The clearing module is used to clear the networking relationship with the second device if a rejection message for the networking request message returned by the second device is received.

[0224] Optionally, the sending module 1903 is further configured to:

[0225] After completing networking with the second device, if it is detected that the target application enters the foreground, a unilateral periodic heartbeat task message is sent to the second device through the first server, and the unilateral periodic heartbeat task message is used to instruct the second device to periodically send a heartbeat message to the first device within a first preset time period;

[0226] Within the first preset time after sending the unilateral periodic heartbeat task message, if the target application exits the foreground, or if the first device switches to the screen-off state, a unilateral periodic heartbeat task stop message is sent to the second device through the first server.

[0227] Optionally, the sending module 1903 is used to:

[0228] If the target message is generated, a session creation notification message is sent to the second device through the first server, where the session creation notification message is used to instruct the second device to create a session;

[0229] If a confirmation message for the session creation notification message sent by the second device is received, a session creation request message is sent to the second server, where the session creation request message is used to request to create a session with the second device;

[0230] Receive a session creation success message sent by the second server.

[0231] In the embodiment of the present application, the terminal and the wearable device can realize the far-field online perception and far-field networking of the terminal and the wearable device by registering the device in the first server and the second server, and then a session between the terminal and the wearable device can be established through the second server, and the far-field message interaction between the terminal and the wearable device can be realized through the session. In this case, no matter how far the terminal and the wearable device are apart, the message synchronization between the terminal and the wearable device can be realized in time, so that the user can be informed of the message he is concerned about in time, which greatly facilitates the user's use.

[0232] It should be noted that: the message sending device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when sending messages. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0233] The functional units and modules in the above embodiments 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, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0234] The message sending device and the message sending method embodiments provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.

[0235] The terminal involved in the embodiment of the present application is described below.

[0236] Fig. 20 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. Fig. 20 The terminal 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 SIM card interface 195, etc. Among them, 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.

[0237] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal 100. In other embodiments of the present application, the terminal 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain 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.

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

[0239] The controller may be the nerve center and command center of the terminal 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.

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

[0241] 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 terminal 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.

[0242] 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 terminal 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 by the terminal 100 during use (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.

[0243] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the terminal 100, and can also be used to transmit data between the terminal 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The USB interface 130 can also be used to connect other devices, such as AR devices, etc.

[0244] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the terminal 100. While the charging management module 140 is charging the battery 142, it may also power the terminal 100 through the power management module 141.

[0245] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0246] The wireless communication function of the terminal 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.

[0247] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0248] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied on the terminal 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0249] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the terminal 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0250] The terminal 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0251] 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 terminal 100 may include 1 or N display screens 194, where N is an integer greater than 1.

[0252] The terminal 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.

[0253] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0254] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the terminal 100 may include 1 or N cameras 193, where N is an integer greater than 1.

[0255] The terminal 100 can implement audio functions, such as music playing and recording, through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D and the application processor.

[0256] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0257] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The terminal 100 may receive key input and generate key signal input related to user settings and function control of the terminal 100.

[0258] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. Touch operations acting on different areas of the display screen 194 can also correspond to different vibration feedback effects. Different application scenarios (such as: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0259] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0260] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the terminal 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The terminal 100 can support 1 or N SIM card interfaces, where N is an integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The terminal 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the terminal 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the terminal 100 and cannot be separated from the terminal 100.

[0261] The wearable device involved in the embodiments of the present application is described below.

[0262] Fig.21 is a schematic diagram of the structure of a wearable device provided in an embodiment of the present application. Fig.21 The wearable device includes at least one processor 211, a communication bus 212, a memory 213 and at least one communication interface 214.

[0263] The processor 211 may be a microprocessor (including a central processing unit (CPU) etc.), an application-specific integrated circuit (ASIC), or may be one or more integrated circuits for controlling the execution of the program of the present application.

[0264] The communication bus 212 may include a pathway for transmitting information between the above-mentioned components.

[0265] The memory 213 may be a read-only memory (ROM), a random access memory (RAM), an electrically erasable programmable read-only memory (EEPROM), an optical disc (including a compact disc read-only memory (CD-ROM), a compressed optical disc, a laser disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 213 may exist independently and be connected to the processor 211 via the communication bus 212. The memory 213 may also be integrated with the processor 211.

[0266] The communication interface 214 uses any device such as a transceiver for communicating with other devices or communication networks.

[0267] In a specific implementation, as an embodiment, the processor 211 may include one or more CPUs, such as Fig.21 CPU0 and CPU1 are shown in the figure.

[0268] In a specific implementation, as an embodiment, the wearable device may include multiple processors, such as Fig.21 211 and processor 215 shown in FIG. Each of these processors may be a single-core processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).

[0269] The memory 213 is used to store the program code 210 for executing the solution of the present application, and the processor 211 is used to execute the program code 210 stored in the memory 213. The wearable device can implement the operations performed by the wearable device in the message sending method described in the above embodiment through the processor 211 and the program code 210 in the memory 213.

[0270] Next, the software system of the electronic device is described. The electronic device may be a terminal or a wearable device.

[0271] The software system of the electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device.

[0272] Fig. 22 is a block diagram of a software system of an electronic device provided in an embodiment of the present application. Fig. 22 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into an application layer, an application framework layer, an Android runtime (AndroidRuntime) and a system layer, and a kernel layer.

[0273] The application layer can include a series of application packages. Fig. 22 As shown, the application package may include target applications, message service modules, gallery, calendar, call, map, navigation, Bluetooth, music, short message and other applications.

[0274] 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 includes some predefined functions.

[0275] like Fig. 22 As shown, the application framework layer may include a management module, a basic communication middle platform, and a trust ring module.

[0276] The application framework layer may also include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like. 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, and the like. The content provider is used to store and obtain data and make the data accessible to the application. The data may include video, images, audio, dialed and received calls, browsing history and bookmarks, phone books, and the like. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and the like. The view system can be used to build the display interface of the application. The display interface may be composed of one or more views, such as a view for displaying a text message notification icon, a view for displaying text, and a view for displaying pictures. The phone manager is used to provide communication functions for electronic devices, such as the management of call status (including connected, hung up, and the like). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear 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 an icon or scroll bar text, such as a notification of an application running in the background. The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message in the status bar, a reminder sound, an electronic device vibrating, an indicator light flashing, etc.

[0277] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the 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 object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0278] The system layer can include multiple functional modules, such as: surface manager, media library, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. 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. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0279] The kernel layer is the layer between hardware and software. The kernel layer can include display drivers, camera drivers, audio drivers, sensor drivers, etc.

[0280] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).

[0281] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.

Claims

1. A message sending method, characterized in that: Applied to a first device, one of the first device and a second device is a terminal and the other is a wearable device, the wearable device has a network access capability, and the method includes: After the first device and the second device establish a short-distance communication connection, register the device on the first server, and register the device on the second server; After the short-distance communication connection between the first device and the second device is disconnected, if it is determined through the first server that the second device is online, networking is performed with the second device; After completing networking with the second device, a session between the first device and the second device is created through the second server, and a target message in the first device is sent to the second device through the session.

2. The method according to claim 1, characterized in that After the first device and the second device establish a short-distance communication connection, registering the device on the first server, and registering the device on the second server, include: After the first device establishes a short-range communication connection with the second device, synchronizing an account with the second device; After completing account synchronization with the second device, if it is detected that the far-field message switch is switched from an off state to an on state, the device is registered on the first server, and the service channel is registered on the second server.

3. The method according to claim 2, characterized in that The method further comprises: If the first device logs out of the account, or if the far-field message switch is switched from the on state to the off state, the device is deregistered on the first server, and the device is deregistered on the second server.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire a device list from the first server, where the device list includes the online and offline status of the second device; and / or, receiving a device online notification message sent by the first server, where the device online notification message is used to indicate that the second device has come online; and / or, A device offline notification message sent by the first server is received, where the device offline notification message is used to indicate that the second device has gone offline.

5. The method according to any one of claims 1 to 4, characterized in that: The networking with the second device includes: Sending a device authentication request message to the second device through the first server; If a confirmation message for the device authentication request message returned by the second device is received, performing same-account authentication with the second device; After completing the same account authentication with the second device, sending a networking request message to the second device through the first server; Receive a confirmation message returned by the second device for the networking request message.

6. The method according to claim 5, characterized in that After the first server sends the networking request message to the second device, the method further includes: If a rejection message for the networking request message returned by the second device is received, the networking relationship with the second device is cleared.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: After completing networking with the second device, if it is detected that the target application enters the foreground, a unilateral periodic heartbeat task message is sent to the second device through the first server, and the unilateral periodic heartbeat task message is used to instruct the second device to periodically send a heartbeat message to the first device within a first preset time length; Within the first preset time after sending the unilateral periodic heartbeat task message, if the target application exits the foreground operation, or if the first device switches to the screen-off state, a unilateral periodic heartbeat task stop message is sent to the second device through the first server.

8. The method according to any one of claims 1 to 7, characterized in that: The creating a session between the first device and the second device through the second server includes: If the target message is generated, sending a session creation notification message to the second device through the first server, where the session creation notification message is used to instruct the second device to create a session; If a confirmation message for the session creation notification message sent by the second device is received, sending a session creation request message to the second server, where the session creation request message is used to request to create a session with the second device; Receive a session creation success message sent by the second server.

9. An electronic device, characterized in that: The electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 8 when executed by the processor.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Message synchronization method and apparatus, and electronic device, storage medium and product

    WO2026171163A1