A method, terminal and system for data transmission

By establishing near-field and far-field communication connections between smart terminals, the problem of data transmission between smart wearable devices and mobile phones outside the Bluetooth communication range is solved, ensuring the continuity of data transmission and user experience.

CN119172735BActive Publication Date: 2026-07-03HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2023-06-20
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In existing technologies, smart wearable devices and mobile phones cannot transmit data when they are outside the Bluetooth communication range, resulting in a reduced user experience.

Method used

By establishing near-field communication connections between smart terminals, and switching to far-field communication connections when the near-field communication range is exceeded, the continuity of data transmission is ensured.

Benefits of technology

It enables continuous data transmission for smart terminals outside the near-field communication range, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119172735B_ABST
    Figure CN119172735B_ABST
Patent Text Reader

Abstract

This application discloses a data transmission method, terminal, readable storage medium, and chip, relating to the field of terminal communication technology. The method includes: pairing a first terminal and a second terminal using near-field communication (NFC), wherein the first terminal has a first application installed, and the second terminal has a second application installed; the first application and the second application belong to the same application. When the first terminal and the second terminal are within NFC range, they establish a NFC connection, and the first application of the first terminal uses the NFC connection to transmit data with the second application of the second terminal. When the first terminal and the second terminal are not within NFC range, they establish a far-field communication (FSC) connection, and the first application of the first terminal uses the FSC connection to transmit data with the second application of the second terminal. Thus, when the NFC connection between the first terminal and the second terminal is broken, the first terminal and the second terminal can promptly establish a far-field communication connection, and complete data transmission between the first application in the first terminal and the second application in the second terminal through this FSC connection, ensuring the continuity of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology for smart terminals, and more particularly to a method, terminal, and system for data transmission between terminal devices. Background Technology

[0002] With the widespread adoption of electronic devices, more and more smart devices have emerged, such as smartphones and wearable devices. Smartwatches, smart bracelets, and other smart wearable devices are widely used. These wearable devices often connect to smartphones via Bluetooth to achieve multiple functions, allowing simultaneous operation of phone calls, text messages, emails, photos, music, and more. However, the application ecosystem for wearable devices is not yet mature. Compared to the comprehensive and complete functions of mobile phone applications, many applications on wearable devices are simple, requiring users to use a smartphone to access their full functionality.

[0003] Currently, some applications on wearable devices require close-range communication with smartphones via Bluetooth. Once the user moves away from the phone beyond Bluetooth's range, these applications become unusable. This degrades the user experience of wearable devices. Summary of the Invention

[0004] This application provides a data transmission method, a terminal, a readable storage medium, and a chip to solve the problem in the prior art that data transmission is impossible when the first terminal and the second terminal are not within the near-field communication range.

[0005] In a first aspect, embodiments of this application provide a data transmission method, the method comprising: pairing a first terminal and a second terminal using near-field communication, wherein the first terminal has a first application installed, the second terminal has a second application installed, and the first application and the second application belong to the same application; when the first terminal and the second terminal are within the near-field communication range, the first terminal and the second terminal establish a near-field communication connection, and the first application of the first terminal uses the near-field communication connection and the second application of the second terminal to transmit data; when the first terminal and the second terminal are not within the near-field communication range, the first terminal and the second terminal establish a far-field communication connection, and the first application of the first terminal uses the far-field communication connection and the second application of the second terminal to transmit data.

[0006] The data transmission method provided in this application embodiment enables the first terminal and the second terminal to establish a far-field communication connection in a timely manner when the near-field communication connection between the first terminal and the second terminal is disconnected. The data transmission between the first application in the first terminal and the second application in the second terminal is completed through the far-field communication connection, thus ensuring the continuity of data transmission.

[0007] In one possible implementation, the first application and the second application are different versions of the same application. In this embodiment, the first terminal can be a mobile phone, the second terminal can be a smartwatch, the first application can be an instant messaging application on the mobile phone, and the second application can be an application on the smartwatch. This enables data transmission between the instant messaging applications on the mobile phone and the smartwatch in scenarios where the mobile phone is close to the smartwatch and the mobile phone is far away from the smartwatch.

[0008] In one possible implementation, the method further includes: a first terminal receiving a first operation from a user, and in response to the first operation, launching a function that supports a first application of the first terminal to perform data transmission using a far-field communication connection and a second application of the second terminal. This allows the user to selectively enable the far-field data transmission function according to their own needs.

[0009] In one possible implementation, the method further includes: a first terminal displaying a first interface, the first interface including a selectable list of far-field data transmission applications, the list including a first application. In this way, the user can selectively enable the far-field data transmission function of some applications according to their own needs.

[0010] In one possible implementation, after the first terminal and the second terminal establish a far-field communication connection, the method further includes: the first terminal displaying a third prompt message, which indicates to the user that the far-field data transmission function in the first terminal has been activated. In this way, the first terminal can promptly notify the user that the far-field data transmission function has been activated, improving the user experience.

[0011] In one possible implementation, the method further includes: in response to a first operation, a first terminal sending a first message to a second terminal, the first message being used to instruct the second terminal to initiate a function that supports a second application of the second terminal to perform far-field data transmission using a far-field communication connection.

[0012] In one possible implementation, the first message also includes a list of applications, which includes the first application of the first terminal.

[0013] In one possible implementation, the first terminal sends the first message via a near-field communication connection.

[0014] In one possible implementation, the first terminal includes a first near-field communication module, the second terminal includes a second near-field communication module, and the establishment of a near-field communication connection between the first terminal and the second terminal includes: the first near-field communication module of the first terminal establishing a near-field communication connection with the second near-field communication module of the second terminal based on the near-field communication address of the second terminal.

[0015] In one possible implementation, the method further includes: the first terminal and the second terminal disconnecting the near-field communication connection, wherein, in response to disconnecting the near-field communication connection, the first terminal further includes a first switching module and a first far-field communication module, the first switching module instructing the first far-field communication module and the second far-field communication module of the second terminal to establish a far-field communication connection.

[0016] In one possible implementation, the first switching module instructs the first far-field communication module and the second far-field communication module of the second terminal to establish a far-field communication connection, including: the first switching module sending a first communication address to the first far-field communication module, and the first far-field communication module establishing a far-field communication connection with the second far-field communication module of the second terminal based on the first communication address, wherein the first communication address is the far-field communication address of the second terminal.

[0017] In one possible implementation, the method further includes: in response to disconnecting the near-field communication connection, the first switching module notifies the first application that the near-field communication connection has been disconnected; in response to the establishment of a far-field communication connection between the first terminal and the second terminal, the first switching module notifies the first application that the near-field communication connection has been established. In this way, the first switching module masks the unavailability of the near-field communication connection to the first application.

[0018] In one possible implementation, the method further includes: in response to disconnecting the near-field communication connection, within a preset time period, when the first terminal and the second terminal successfully establish a far-field communication connection, the first switching module does not notify the first application that the near-field communication connection has been disconnected; when the first terminal and the second terminal fail to establish a far-field communication connection, the first switching module notifies the first application that the near-field communication connection has been disconnected. Thus, when the first terminal and the second terminal successfully establish a far-field communication connection within the preset time period, the first switching module masks the unavailability of the near-field communication connection to the first application.

[0019] In one possible implementation, the first terminal includes a first near-field communication application interface, and the first application of the first terminal uses a far-field communication connection and a second application of the second terminal to perform data transmission, including: the first application of the first terminal calling the first near-field communication application interface and using the far-field communication connection and the second application of the second terminal to perform data transmission.

[0020] In one possible implementation, the near-field communication connection includes a Bluetooth communication connection or a Wi-Fi Direct communication connection, and the far-field communication connection includes a Wi-Fi communication connection or a cellular communication connection.

[0021] In one possible implementation, when the first terminal and the second terminal are within near-field communication range, they also establish a far-field communication connection. The first application on the first terminal simultaneously uses both the near-field and far-field communication connections to transmit data with the second application on the second terminal. In this way, when the first and second terminals are within near-field communication range, the first application on the first terminal can use either the near-field or far-field communication connection to transmit data, improving the efficiency and reliability of data transmission.

[0022] In one possible implementation, the first terminal includes a mobile phone or tablet, and the second terminal includes a smartwatch, smart glasses, or a smart vehicle system.

[0023] In one possible implementation, the first terminal includes a smartwatch, smart glasses, or a smart vehicle system, and the second terminal includes a mobile phone or tablet.

[0024] Secondly, embodiments of this application provide a data transmission method, the method comprising: pairing a second terminal and a first terminal using near-field communication, wherein the first terminal has a first application installed, the second terminal has a second application installed, and the first application and the second application belong to the same application; when the second terminal and the first terminal are within the near-field communication range, the second terminal and the first terminal establish a near-field communication connection, and the second application of the second terminal uses the near-field communication connection to transmit data with the first application of the first terminal; when the second terminal and the first terminal are not within the near-field communication range, the second terminal and the first terminal establish a far-field communication connection, and the second application of the second terminal uses the far-field communication connection to transmit data with the first application of the first terminal.

[0025] The data transmission method provided in this application embodiment enables the second terminal and the first terminal to establish a far-field communication connection in a timely manner when the near-field communication connection between the second terminal and the first terminal is disconnected. The data transmission between the second application in the second terminal and the first application in the first terminal is completed through the far-field communication connection, thus ensuring the continuity of data transmission.

[0026] In one possible implementation, the first application and the second application are different versions of the same application. In this embodiment, the second terminal can be a smartwatch, the first terminal can be a mobile phone, the second application can be an application on the smartwatch, and the first application can be an instant messaging application on the mobile phone. This enables data transmission between the instant messaging applications on the mobile phone and the smartwatch in scenarios where the mobile phone is close to the smartwatch and when the mobile phone is far away from the smartwatch.

[0027] In one possible implementation, after the far-field communication connection is established between the second terminal and the first terminal, the method further includes: the second terminal displaying a fourth prompt message, which notifies the user that the far-field data transmission function in the second terminal has been activated. In this way, the second terminal can promptly notify the user that the far-field data transmission function is active after it has been activated, thus improving the user experience.

[0028] In one possible implementation, the method further includes: a second terminal receiving a first message from a first terminal, the first message being used to instruct the second terminal to initiate a function that supports a second application of the second terminal to perform far-field data transmission using a far-field communication connection.

[0029] In one possible implementation, in response to the received first message, the second terminal displays a first prompt message, which is used to prompt the user that the second terminal has enabled the far-field data transmission function.

[0030] In one possible implementation, the first message also includes a list of applications, which includes a first application of the first terminal.

[0031] In one possible implementation, the second terminal receives the first message via a near-field communication connection.

[0032] In one possible implementation, the first terminal includes a first near-field communication module, the second terminal includes a second near-field communication module, and the establishment of a near-field communication connection between the second terminal and the first terminal includes: the second near-field communication module of the second terminal establishing a near-field communication connection with the first near-field communication module of the first terminal according to the near-field communication address of the first terminal device.

[0033] In one possible implementation, the second terminal and the first terminal establish a far-field communication connection, including: the second terminal and the first terminal disconnect the near-field communication connection, and in response to disconnecting the near-field communication connection, the second terminal further includes a second switching module and a second far-field communication module, the second switching module instructing the second far-field communication module and the first far-field communication module of the first terminal to establish a far-field communication connection.

[0034] In one possible implementation, the second switching module instructs the second far-field communication module and the first far-field communication module of the first terminal to establish a far-field communication connection, including: the second switching module sending a second communication address to the second far-field communication module, and the second far-field communication module establishing a far-field communication connection with the first far-field communication module of the first terminal based on the second communication address, wherein the second communication address is the far-field communication address of the first terminal.

[0035] In one possible implementation, the method further includes: in response to disconnecting the near-field communication connection, the second switching module notifies the second application that the near-field communication connection has been disconnected; in response to the first terminal and the second terminal establishing a far-field communication connection, the second switching module notifies the second application that the near-field communication connection has been established. In this way, the second switching module masks the unavailability of the near-field communication connection to the second application.

[0036] In one possible implementation, the method further includes: in response to disconnecting the near-field communication connection, within a preset time period, when the first terminal and the second terminal successfully establish a far-field communication connection, the second switching module does not notify the second application that the near-field communication connection has been disconnected; when the first terminal and the second terminal fail to establish a far-field communication connection, the second switching module notifies the second application that the near-field communication connection has been disconnected. Thus, when the first terminal and the second terminal successfully establish a far-field communication connection within the preset time period, the second switching module masks the unavailability of the near-field communication connection to the second application.

[0037] In one possible implementation, the second terminal includes a second near-field communication application interface, and the second application of the second terminal uses a far-field communication connection to perform data transmission with the first application of the first terminal, including: the second application of the second terminal calling the second near-field communication application interface to perform data transmission with the first application of the first terminal through the far-field communication connection.

[0038] In one possible implementation, the near-field communication connection includes a Bluetooth communication connection or a Wi-Fi Direct communication connection, and the far-field communication connection includes a Wi-Fi communication connection or a cellular communication connection.

[0039] In one possible implementation, when the second terminal and the first terminal are within near-field communication range, they also establish a far-field communication connection. The second application on the second terminal uses both the near-field and far-field communication connections to transmit data with the first application on the first terminal. In this way, when the second terminal and the first terminal are within near-field communication range, the second application on the second terminal can use either the near-field or far-field communication connection to transmit data with the first application on the first terminal, improving the efficiency and reliability of data transmission.

[0040] In one possible implementation, the first terminal includes a mobile phone or tablet, and the second terminal includes a smartwatch, smart glasses, or a smart vehicle system.

[0041] In one possible implementation, the first terminal includes a smartwatch, smart glasses, or a smart vehicle system, and the second terminal includes a mobile phone or tablet.

[0042] Thirdly, embodiments of this application provide a data transmission method, which is applied to a first terminal and a second terminal, wherein the first terminal executes the method as shown in the first aspect and its various implementations above, and the second terminal executes the method as shown in the second aspect and its various implementations above.

[0043] Fourthly, embodiments of this application provide a first terminal, the first terminal comprising: one or more processors, one or more memories, the one or more memories storing one or more computer programs, the one or more computer programs including instructions, which, when executed by one or more processors, cause the first terminal to implement the methods shown in the first aspect and various implementations of the first aspect above.

[0044] Fifthly, embodiments of this application provide a second terminal, the second terminal comprising: one or more processors, one or more memories, the one or more memories storing one or more computer programs, the one or more computer programs including instructions, which, when executed by one or more processors, cause the second terminal to implement the methods shown in the second aspect and various implementations thereof.

[0045] Sixthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods shown in the first aspect and various implementations thereof, as well as the methods shown in the second aspect and various implementations thereof.

[0046] In a seventh aspect, embodiments of this application provide a chip including a processor and a memory, the memory storing a computer program, which, when executed by the processor, implements the methods shown in the first aspect and its various implementations, as well as the methods shown in the second aspect and its various implementations.

[0047] Eighthly, embodiments of this application provide a data transmission system, the system including a first terminal and a second terminal, wherein the first terminal executes the method as shown in the first aspect and various implementations thereof, and the second terminal executes the method as shown in the second aspect and various implementations thereof. Attached Figure Description

[0048] Figure 1A This is a schematic diagram of the structure of the terminal device provided in the embodiments of this application;

[0049] Figure 1B This is a software structure block diagram of a terminal device provided in an embodiment of this application;

[0050] Figure 2 A schematic diagram of a network architecture provided for an embodiment of this application;

[0051] Figure 3 A schematic diagram of a software architecture provided for an embodiment of this application;

[0052] Figure 4 This is a schematic diagram of another network architecture provided in an embodiment of this application;

[0053] Figure 5 Another software architecture diagram provided for an embodiment of this application;

[0054] Figure 6 A flowchart illustrating a data transmission method provided in an embodiment of this application;

[0055] Figure 7 A flowchart illustrating another data transmission method provided in this application embodiment;

[0056] Figures 8a-8f A UI diagram for setting up far-field data transmission is provided in an embodiment of this application;

[0057] Figures 9a-9e Another UI diagram for setting up far-field data transmission is provided in the embodiments of this application;

[0058] Figures 10a-10d Another UI diagram for setting up far-field data transmission is provided in the embodiments of this application;

[0059] Figure 11 Another UI diagram for setting up far-field data transmission is provided in the embodiments of this application;

[0060] Figure 12 This is a schematic diagram of another network architecture provided in an embodiment of this application;

[0061] Figure 13 This is a schematic diagram of the structure of the first terminal provided in an embodiment of this application;

[0062] Figure 14 This is a schematic diagram of the structure of the second terminal provided in an embodiment of this application. Detailed Implementation

[0063] To facilitate understanding of this application, the concept of the apparatus involved in this application will first be explained.

[0064] The device involved in this application refers to a terminal device with communication transmission function. Multiple apps can be installed on the terminal device to provide users with different functions. For example, the terminal device can send and receive messages through an instant messaging app. The terminal device can be a mobile phone, computer, watch, tablet, in-vehicle device, wearable device, industrial equipment, artificial intelligence device, augmented reality (AR) device, virtual reality (VR) device, etc.

[0065] The following is combined with Figure 1A The structure of the terminal equipment is described below:

[0066] Figure 1A See the schematic diagram of the terminal device provided in the embodiments of this application. Figure 1A Terminal 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity 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.

[0067] It is understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the terminal 100. In other embodiments of this application, the terminal 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0068] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0069] The controller can serve as the central nervous system and command center of the terminal 100. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.

[0070] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0071] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0072] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby realizing the touch function of the terminal 100.

[0073] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls through a Bluetooth headset.

[0074] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering phone calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0075] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.

[0076] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the shooting function of the terminal 100. The processor 110 and the display screen 194 communicate via the DSI interface to enable the display function of the terminal 100.

[0077] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0078] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge terminal 100, and can also be used for data transfer between terminal 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other terminals, such as AR devices.

[0079] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the terminal 100. In other embodiments of this application, the terminal 100 may also adopt different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.

[0080] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the terminal 100. While charging the battery 142, the charging management module 140 can also supply power to the terminal via the power management module 141.

[0081] The power management module 141 connects 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, providing power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0082] The wireless communication function of terminal 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0083] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0084] The mobile communication module 150 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the terminal 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0085] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0086] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. 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 antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0087] In some embodiments, antenna 1 of terminal 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling terminal 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0088] Terminal 100 implements display functions through a GPU, display screen 194, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0089] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, terminal 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0090] Terminal 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0091] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0092] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, terminal 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0093] A digital signal processor (DSP) is used to process digital signals. Besides digital image signals, it can also process other digital signals. For example, when terminal 100 selects a frequency point, the DSP can perform Fourier transforms on the frequency energy.

[0094] Video codecs are used to compress or decompress digital video. Terminal 100 may support one or more video codecs. Thus, terminal 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.

[0095] NPU stands for Neural Network (NN) Computing Processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs can enable intelligent cognitive applications in terminals, such as image recognition, facial recognition, speech recognition, and text understanding.

[0096] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the terminal 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0097] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of terminal 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of terminal 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0098] Terminal 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0099] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.

[0100] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The terminal 100 can listen to music or make hands-free calls through the speaker 170A.

[0101] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the terminal 100 receives a phone call or voice message, the receiver 170B can be brought close to the listener's ear to hear the voice.

[0102] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Terminal 100 may have at least one microphone 170C. In some embodiments, terminal 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, terminal 100 may have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.

[0103] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.

[0104] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Terminal 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, terminal 100 detects the intensity of the touch operation based on pressure sensor 180A. Terminal 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example: when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.

[0105] The gyroscope sensor 180B can be used to determine the motion attitude of the terminal 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the terminal 100 around three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the terminal 100's shake, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the terminal 100 through reverse movement, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.

[0106] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.

[0107] The magnetic sensor 180D includes a Hall sensor. The terminal 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the terminal 100 is a flip phone, the terminal 100 can detect the opening and closing of the flip cover using the magnetic sensor 180D. Then, based on the detected opening and closing state of the cover or the flip cover, features such as automatic flip unlocking can be set.

[0108] The 180E accelerometer can detect the magnitude of acceleration of terminal 100 in various directions (typically three axes). When terminal 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the terminal's posture and applied to applications such as screen orientation switching and pedometers.

[0109] A distance sensor 180F is used to measure distance. The terminal 100 can measure distance via infrared or laser. In some embodiments, during a shooting scene, the terminal 100 can utilize the distance sensor 180F to measure distance for rapid focusing.

[0110] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The terminal 100 emits infrared light outward through the LED. The terminal 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the terminal 100. When insufficient reflected light is detected, the terminal 100 can determine that there is no object near the terminal 100. The terminal 100 may use the proximity sensor 180G to detect when a user holds the terminal 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and screen locking.

[0111] The ambient light sensor 180L is used to sense the ambient light intensity. The terminal 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light intensity. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the terminal 100 is in a pocket to prevent accidental touches.

[0112] The fingerprint sensor 180H is used to collect fingerprints. The terminal 100 can use the characteristics of the collected fingerprints to unlock the device, access application locks, take photos with the fingerprint, and answer calls with the fingerprint.

[0113] Temperature sensor 180J is used to detect temperature. In some embodiments, terminal 100 uses the temperature detected by temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, terminal 100 reduces the performance of the processor located near temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is below another threshold, terminal 100 heats battery 142 to prevent abnormal shutdown of terminal 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, terminal 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.

[0114] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of terminal 100, in a different position than display screen 194.

[0115] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.

[0116] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Terminal 100 can receive button input and generate key signal inputs related to user settings and function control of terminal 100.

[0117] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. 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 be customized.

[0118] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.

[0119] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the terminal 100. The terminal 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The terminal 100 interacts with the network through the SIM card to realize functions such as calls and data communication. 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.

[0120] Terminal 100 may also include a magnetometer (not shown in the figure), also known as an electronic compass or compass, which can be used to detect the strength and direction of the magnetic field.

[0121] Figure 1B This is a software structure block diagram of a terminal device according to an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the system framework layer, the system library and runtime layer, and the kernel layer.

[0122] The application layer can include applications such as camera, gallery, calendar, fitness tracking, Wi-Fi, music, and video. It should be noted that... Figure 1B The applications included in the application layer shown are merely illustrative and are not intended to limit the scope of this application. It is understood that the applications included in the application layer do not constitute a specific limitation on the mobile phone 100. In other embodiments of this application, compared to... Figure 1B The application layer shown contains applications. Mobile phone 100 may include more or fewer applications, or it may include completely different applications.

[0123] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer, including various components and services to support Android development. The system framework layer includes some predefined functions. For example... Figure 1BAs shown, the system framework layer may include a view system, window manager, resource manager, content provider, etc. The view system includes visual controls, such as controls for displaying text and controls for displaying images. A control is a graphical user interface element, including buttons, icons, text boxes, etc. The view system can be used to build applications. The display interface can consist of one or more views. The window manager is used to manage window programs. The window manager can obtain the screen size, determine if there is a status bar, lock the screen, capture the screen, etc. The resource manager provides various resources to the application, such as localized strings, icons, images, layout files, video files, etc. The content provider is used to store and retrieve data, and make this data accessible to the application. The data may include video, images, audio, etc.

[0124] The system library and runtime layer include the system library and the Android Runtime. The system library can include multiple functional modules, such as the browser engine, 3D graphics libraries (e.g., OpenGL ES), and font libraries. The browser engine is responsible for interpreting web page syntax (such as HTML and JavaScript, applications of Standard Generalized Markup Language) and rendering (displaying) the web page. The 3D graphics library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The font library is used to implement different font input. The Android Runtime includes the core library and the virtual machine. The Android Runtime is responsible for the scheduling and management of the Android system. The core library consists of two parts: one part contains the functionalities that Java needs to call, and the other part contains the Android core libraries. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0125] Understandable Figure 1B The components included in the system framework layer, system library, and runtime layer shown do not constitute a specific limitation on the mobile phone 100. In other embodiments of this application, the mobile phone 100 may include more or fewer components than shown, or combine some components, or split some components, or have different component arrangements.

[0126] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0127] Based on the structure of the terminal device described above, the background technology involved in this application will be further described in detail below. Figure 2 An exemplary diagram of a network architecture is shown. Figure 2The network architecture shown may include a first terminal 201 and a second terminal 202. The first terminal 201 can establish a near-field communication (NFC) connection 203 with the second terminal 202. This NFC connection 203 can be a Bluetooth connection, a Wi-Fi Direct connection, an NFC connection, or a ZigBee connection, etc. The Wi-Fi Direct connection is also called a Wi-Fi P2P connection, and this embodiment does not limit this. Specifically, in this embodiment, the first terminal 201 and the second terminal 202 can complete data transmission and reception within a short range via NFC. NFC can also be called short-range communication, and this embodiment does not limit this. Figure 2 In the network architecture shown, the first terminal 201 may include various terminals such as mobile phones, tablets, personal digital assistants, mobile internet devices, and vehicle terminals, while the second terminal 202 may include various wearable devices such as smart bracelets, smartwatches, and smart glasses, or other smart terminals such as vehicle devices. The above are examples, and the embodiments of this application are not limited.

[0128] Figure 3 An example is shown Figure 2 A schematic diagram of a software architecture for the first terminal 201 and the second terminal 202 in the network architecture shown.

[0129] like Figure 3 As shown, the first terminal 201 includes an application layer, an application framework layer, and a hardware layer. The application layer of the first terminal 201 includes one or more first applications, which are applications with full functionality. The first applications can be clock applications, calendar applications, gallery applications, instant messaging applications, etc.

[0130] It should be noted that a fully functional application means that the first terminal 201 with the application installed can perform all the functions of the application without the need for other devices. For example, the first terminal 201 with an instant messaging application installed can independently receive and send messages.

[0131] like Figure 3 As shown, the application framework layer of the first terminal 201 may include a far-field communication application interface (FCL) and a near-field communication application interface (NFC). The far-field communication application interface provides an interface for upper-layer applications to access the far-field communication module, and may include a cellular communication application interface or a Wi-Fi communication application interface, etc. The near-field communication application interface provides an interface for upper-layer applications to access the near-field communication module, and may include a Bluetooth communication application interface, a Wi-Fi Direct communication application interface, an NFC communication application interface, or a ZigBee communication application interface, etc.

[0132] The application framework layer of the first terminal 201 may also include other software modules, as detailed in [reference needed]. Figure 1B The description will not be repeated here.

[0133] like Figure 3 As shown, the hardware layer of the first terminal 201 may include a far-field communication module and a near-field communication module. Specifically, the far-field communication module may include a far-field communication protocol stack and a far-field communication driver, and the near-field communication module may include a near-field communication protocol stack and a near-field communication driver.

[0134] In one possible implementation, the far-field communication protocol stack can be deployed on... Figure 1B The system library shown in the software structure, the far-field communication driver can be deployed in... Figure 1B The kernel layer in the software architecture shown is not limited in this embodiment. The far-field communication protocol stack includes a cellular communication protocol stack or a Wi-Fi communication protocol stack, etc. Taking a cellular communication protocol stack as an example, it includes an LTE protocol stack or an NR protocol stack, etc. The far-field communication driver provides the upper layer with the function of accessing the far-field communication chip. The far-field communication driver may include a cellular communication driver or a Wi-Fi communication driver, etc.

[0135] In one possible implementation, the near-field communication protocol stack can be deployed on Figure 1B The system library shown in the software structure, the near-field communication driver can be deployed in... Figure 1B The kernel layer in the software structure shown is not limited in this embodiment. The near-field communication protocol stack includes Bluetooth, Wi-Fi Direct, NFC, or ZigBee protocols. Taking the Bluetooth protocol stack as an example, it defines multiple profiles and core protocols within the Bluetooth framework. Each profile defines its own message format and application rules; a profile is a Bluetooth service. To achieve interoperability between different devices on different platforms, the Bluetooth protocol has defined specifications for various possible and universally applicable application scenarios, such as A2DP (Advanced Audio Distribution Profile) and HFP (Hands-Free Profile). Core protocols include, but are not limited to, the Bluetooth Basic Service Protocol SDP (Service Discovery Protocol) and the Logical Link Control and Adaptation Protocol L2CAP (Logical Link Control and Adaptation Protocol). Core protocols are indispensable in the Bluetooth protocol stack.

[0136] The Bluetooth protocol in this application embodiment supports Classic Bluetooth (Basic Rate / Enhanced Data Rate, BR / EDR) and / or Bluetooth Low Energy (BLE). The Bluetooth protocol may also include different versions of the Bluetooth protocol, such as Bluetooth versions 1.0, 1.2, 2.0+EDR, 3.0+HS, 4.0, 4.1, 4.2, and 5.0.

[0137] Near Field Communication (NFC) drivers provide upper layers with access to the NFC chip. NFC drivers can include Bluetooth, Wi-Fi Direct, NFC, or ZigBee drivers, among others.

[0138] The first application in the first terminal 201 can access the far-field communication module by calling the far-field communication application interface, or it can access the near-field communication module by calling the near-field communication application interface. It should be noted that when the first application in the first terminal 201 and the second terminal 202 are transmitting data, the first application only completes the data transmission by calling the near-field communication application interface to access the near-field communication module.

[0139] like Figure 3 As shown, the second terminal 202 includes an application layer, an application framework layer, and a hardware layer. The application layer of the second terminal 202 includes one or more second applications, which are applications without full functionality. These second applications can be clock applications, calendar applications, gallery applications, instant messaging applications, etc. It should be noted that an application without full functionality means that the second terminal 202 with that application installed requires other devices to complete all the functions of that application. For example, the second terminal 202 with instant messaging application 202A installed needs the first terminal 201 to receive and send messages.

[0140] The descriptions of the application framework layer and hardware layer in the second terminal 202 can refer to the above description of the first terminal 201, and will not be repeated here.

[0141] It should be noted that, due to the functional limitations of the second application, it only accesses the near-field communication module by calling the near-field communication application programming interface (NFC). That is, when the second application in the second terminal 202 and the first terminal 201 transmit data, the second application only completes the data transmission by calling the NFC ...

[0142] Figure 3 The first application in the first terminal 201 and the second application in the second terminal 202 are two different versions of the same application.

[0143] See also Figure 3In one possible embodiment, taking instant messaging application 201A as the first application and instant messaging application 202A as the second application as an example, a near-field communication (NFC) connection 203 is established between instant messaging application 201A on the first terminal 201 and instant messaging application 202A on the second terminal 202. This NFC connection 203 can be a Bluetooth connection, a Wi-Fi Direct connection, an NFC connection, or a ZigBee connection, etc. Specifically, instant messaging application 201A on the first terminal 201 and instant messaging application 202A on the second terminal 202 are two different versions of the same instant messaging application; for example, instant messaging application 201A is a fully functional application, while instant messaging application 202A is an incomplete application. When the first terminal 201 and the second terminal 202 are within the communication range of the NFC connection 203, instant messaging application 202A on the second terminal 202 can receive and send messages through the NFC connection 203, meaning that instant messaging application 202A on the second terminal 202 can achieve the full functionality of the instant messaging application with the help of the first terminal 201. However, when the first terminal 201 and the second terminal 202 exceed the communication range of the near-field communication connection 203, due to the functional limitations of the instant messaging application 202A on the second terminal 202, the instant messaging application 202A only calls the near-field communication application interface. Therefore, the instant messaging application 202A cannot complete the reception and sending of messages. In other words, the instant messaging application 202A on the second terminal 202 cannot realize the full functionality of the instant messaging application, thus reducing the user experience of the second terminal 202. In this embodiment, the instant messaging application 201A is an example of a first application on the first terminal 201. The first application on the first terminal 201 can also be other applications, such as the system notification application 202A. This embodiment does not limit this. Similarly, the instant messaging application 202A is an example of a second application on the second terminal 202. The second application on the second terminal 202 can also be other applications, such as the system notification application 202B. This embodiment does not limit this.

[0144] To address the technical problems existing in the prior art, this application provides a data transmission method. Figure 4 An exemplary embodiment of this application illustrates a network architecture, in Figure 4The network architecture shown may include a first terminal 201 and a second terminal 202. The first terminal 201 and the second terminal 202 can establish a near-field communication connection 203 or a far-field communication connection 204. The near-field communication connection 203 may include a Bluetooth communication connection, a Wi-Fi Direct communication connection, an NFC communication connection, or a ZigBee communication connection. The far-field communication connection 204 may include a Wi-Fi communication connection or a cellular communication connection. In this embodiment, when the first terminal 201 and the second terminal 202 are within the near-field communication range, a first application in the first terminal 201 completes data transmission with a second application in the second terminal 202 through the near-field communication connection 203. When the first terminal 201 and the second terminal 202 are outside the near-field communication range, the first application in the first terminal 201 completes data transmission with the second application in the second terminal 202 through the far-field communication connection 204.

[0145] in, Figure 4 The network architecture shown also includes a server 210, through which the first terminal 201 and the second terminal 202 can establish a far-field communication connection. In some embodiments, a first application in the first terminal 201 can use the server 210 as an intermediary to complete data transmission between the first application in the first terminal 202 and the second application in the second terminal 202.

[0146] Furthermore, in Figure 4 Based on the network architecture shown, Figure 5 An exemplary software architecture diagram of a first terminal 201 and a second terminal 202 in an embodiment of this application is shown.

[0147] and Figure 3In contrast, the application framework layer in the first terminal 201 and the second terminal 202 also includes a switching module. This switching module is connected to the near-field communication (NFC) application interface and to both the far-field communication module and the NFC module. When the first terminal 201 and the second terminal 202 are within the NFC range, the NFC application interface can access the NFC module through the switching module, allowing the first application on the first terminal 201 and the second application on the second terminal 202 to complete data transmission using the NFC connection 203. When the first terminal 201 and the second terminal 202 are outside the NFC range, the NFC application interface can access the far-field communication module through the switching module, allowing the first application on the first terminal 201 and the second application on the second terminal 202 to complete data transmission using the far-field communication connection 204. In one possible implementation, the switching module can be part of the NFC application interface or the NFC module; this embodiment does not limit this. Specifically, the switching module is a software module that performs the functions provided in this embodiment through a computer program or one or more functions. In some possible embodiments, the switching module can also be called a distribution module; this embodiment does not limit this.

[0148] In this embodiment, the first terminal 201 and the second terminal 202 do not require any modifications to the first application and the second application. Only the implementation of the near-field communication application interface is modified, allowing the first terminal 201 and the second terminal 202 to complete data transmission between the first application in the first terminal 201 and the second application in the second terminal 202, depending on the near-field communication conditions, via a switching module using near-field communication connection 203 or far-field communication connection 204. In other words, the first application and the second application still complete data transmission between the first terminal 201 and the second terminal 202 in scenarios where the second terminal 202 is close to the first terminal 201 and in scenarios where the second terminal 202 is far from the first terminal 201, by calling the near-field communication application interface.

[0149] based on Figure 5 The illustrated embodiment of this application provides a software architecture for a first terminal 201 and a second terminal 202. The first terminal 201 has a first application installed, and the second terminal 202 has a second application installed. The first and second applications belong to the same application. This embodiment of the application provides a method for data transmission. Figure 6 An exemplary flowchart of the method for transmitting the data is shown, including:

[0150] S601, the first terminal 201 and the second terminal 202 are paired using near-field communication.

[0151] S602, when the first terminal 201 and the second terminal 202 are within the near-field communication range, the first terminal 201 and the second terminal 202 establish a near-field communication connection, and the first application of the first terminal 201 and the second application of the second terminal 202 use the near-field communication connection to transmit data.

[0152] S603, when the first terminal 201 and the second terminal 202 are not within the near-field communication range, the first terminal 201 and the second terminal 202 establish a far-field communication connection, and the first application of the first terminal 201 and the second application of the second terminal 202 use the far-field communication connection to transmit data.

[0153] In this way, when the near-field communication connection between the first terminal 201 and the second terminal 202 is lost, the first terminal 201 and the second terminal 202 can promptly establish a far-field communication connection, and complete the data transmission between the first application in the first terminal 201 and the second application in the second terminal 202 through this far-field communication connection, ensuring the continuity of data transmission. It should be noted that the first application and the second application can belong to the same version of the same application, or they can belong to different versions of the same application.

[0154] In one possible embodiment, taking Bluetooth communication as an example of near-field communication, in Figure 4 Based on the network architecture shown, Figure 7 An exemplary flowchart illustrates a data transmission method provided in one embodiment of this application, including:

[0155] S701, the first terminal 201 and the second terminal 202 pair via Bluetooth.

[0156] In one possible implementation, both the first terminal 201 and the second terminal 202 enable Bluetooth communication. The first terminal 201 selects the scanned second terminal 202 in the Bluetooth device interface and sends a Bluetooth pairing request to the second terminal 202. The second terminal 202 accepts the Bluetooth pairing request from the first terminal 201 and completes the Bluetooth pairing.

[0157] In another possible implementation, both the first terminal 201 and the second terminal 202 enable Bluetooth communication, and the first terminal 201 completes Bluetooth pairing by scanning the QR code displayed on the second terminal 202. This application embodiment does not limit the method of Bluetooth pairing.

[0158] S702, the first terminal 201 obtains the unique identification information of the second terminal 202, and sends the unique identification information of the first terminal 201 and the unique identification information of the second terminal 202 to the server 210.

[0159] Specifically, the first terminal 201 obtains the unique identification information of the second terminal 202 via Bluetooth communication. The unique identification information of the second terminal 202 can be its Bluetooth MAC address, International Mobile Equipment Identity (IMEI), etc., and this embodiment does not limit this. Further, the first terminal 201 obtains its own unique identification information, which can be its Bluetooth MAC address, International Mobile Equipment Identity (IMEI), etc., and this embodiment does not limit this. Then, the first terminal 201 sends the unique identification information of the second terminal 202 and its own unique identification information to the server 210, and the server 210 marks the first terminal 201 and the second terminal 202 as paired devices. Further, the first terminal 201 can also send the account information of the second terminal 202 and its own account information to the server 210. The account information of the second terminal 202 and the first terminal 201 can belong to the same account or different accounts, and this embodiment does not limit this.

[0160] In one possible implementation, the second terminal 202 can obtain the unique identification information of the first terminal 201 and send the unique identification information of the second terminal 202 and the unique identification information of the first terminal 201 to the server 210. This application embodiment does not limit this.

[0161] In another possible implementation, Bluetooth pairing is not required between the first terminal 201 and the second terminal 202. Instead, the first terminal 201 and the second terminal 202 transmit unique identification information of the terminal devices via Bluetooth broadcast. The Bluetooth broadcast can be Bluetooth Low Energy (BLE) broadcast, and this embodiment does not limit this to a specific method.

[0162] S703, when the first terminal 201 and the second terminal 202 are within Bluetooth communication range, the first application in the first terminal 201 and the second application in the second terminal 202 use Bluetooth near-field communication connection to transmit data.

[0163] Specifically, when the first terminal 201 and the second terminal 202 are within Bluetooth communication range, a Bluetooth near-field communication connection is established between them. The first application in the first terminal 201 and the second application in the second terminal 202 use this Bluetooth near-field communication connection to transmit data.

[0164] In one possible embodiment, the first application on the first terminal 201 is an instant messaging application 201A, and the second application on the second terminal 202 is an instant messaging application 202A. Instant messaging application 201A and instant messaging application 202A are two different versions of the same instant messaging application; for example, instant messaging application 201A is a fully functional application, while instant messaging application 202A is an incomplete application. It should be noted that when a Bluetooth near-field communication (NFC) connection is established between the first terminal 201 and the second terminal 202, the switching module on the first terminal 201 and the second terminal 202 maintains the currently available communication link between the first terminal 201 and the second terminal 202 as a Bluetooth NFC connection. Specifically, in one possible implementation, the information maintained by the switching module of the first terminal 201 is shown in Table 1, and the information maintained by the switching module of the second terminal 202 is shown in Table 2. Tables 1 and 2 provide information maintained by the switching modules of the first terminal 201 and the second terminal 202, which may also include other information, such as the Bluetooth communication address of the peer device. This embodiment does not limit this information.

[0165] peer equipment Available communication links Second Terminal 202 Bluetooth near field communication connection

[0166] Table 1

[0167] peer equipment Available communication links First Terminal 201 Bluetooth near field communication connection

[0168] Table 2

[0169] In one possible implementation, the switching module of the first terminal 201 sends the Bluetooth communication address of the peer device, i.e. the Bluetooth communication address of the second terminal 202, to the far-field communication module of the first terminal 201. The switching module of the first terminal 201 then establishes a Bluetooth communication connection with the second terminal 202 based on the Bluetooth communication address of the second terminal 202.

[0170] In one possible implementation, taking the instant messaging application 201A on the first terminal 201 sending data to the instant messaging application 202A on the second terminal 202 as an example, a first Bluetooth transmission channel is established between the instant messaging application 201A on the first terminal 201 and the instant messaging application 202A on the second terminal 202, and a binding relationship is established between the first Bluetooth transmission channel and the instant messaging application. The first Bluetooth transmission channel is a Bluetooth transmission channel established based on a Bluetooth near-field communication connection. The instant messaging application 201A on the first terminal 201 calls the near-field communication application interface, i.e., the Bluetooth communication application interface, to send application data and device information of the second terminal 202 to the Bluetooth communication application interface. The device information may be the device name or the device's Bluetooth MAC address, etc., which is not limited in this embodiment. The Bluetooth communication application interface on the first terminal 201 calls the switching module to send application data to the switching module. The switching module on the first terminal 201 queries the peer device information and determines that the available communication link between the first terminal 201 and the second terminal 202 is a Bluetooth near-field communication (NFC) connection. Therefore, the switching module on the first terminal 201 calls the NFC module, i.e., the Bluetooth communication module, to send application data to the Bluetooth communication module. The Bluetooth communication module on the first terminal 201 generates data to be sent based on the Bluetooth communication address of the second terminal 202, the Bluetooth communication address of the first terminal 201, and the application data, and sends the data to be sent to the Bluetooth communication module on the second terminal 202 through the first Bluetooth transmission channel. The data to be sent includes application data and the destination address, i.e., the Bluetooth communication address of the second terminal 202. In one possible implementation, the data to be sent also includes the source address, i.e., the Bluetooth communication address of the first terminal 201. The Bluetooth communication module on the second terminal 202 receives the data to be sent on the first Bluetooth transmission channel, parses it to obtain the application data, and sends the application data to the NFC application programming interface (API) through the switching module. The Bluetooth API on the second terminal 202 sends the application data to the instant messaging application 202A according to the binding relationship between the first Bluetooth transmission channel and the instant messaging application. In one possible implementation, after the Bluetooth communication module on the second terminal 202 parses and obtains the application data, it directly sends the application data to the Bluetooth communication application programming interface. This application embodiment does not limit this. The process of the instant messaging application 202A on the second terminal 202 sending data to the instant messaging application 201A on the first terminal 201 is similar to the above description, and this application embodiment will not repeat it.

[0171] In one possible implementation, the switching module on the first terminal 201 queries the peer device information contained in the application data to determine that the currently usable communication link between the first terminal 201 and the second terminal 202 is a Bluetooth near-field communication (NFC) connection. The switching module on the first terminal 201 adds a first identifier to the application data to generate first application data, whereby the first identifier indicates that the application data is of NFC data type. The switching module on the first terminal 201 calls the NFC module, i.e., the Bluetooth communication module, to send the first application data to the Bluetooth communication module. The Bluetooth communication module on the first terminal 201 generates data to be sent based on the Bluetooth communication address of the second terminal 202, the Bluetooth communication address of the first terminal 201, and the first application data, and sends the data to be sent to the Bluetooth communication module on the second terminal 202 through the first Bluetooth transmission channel. When the Bluetooth communication module on the second terminal 202 receives the data to be sent on the first Bluetooth transmission channel, it parses it to obtain the first application data and sends it to the switching module. The switching module on the second terminal 202 parses the first application data to obtain the first identifier and the application data, and sends the application data to the Bluetooth communication application programming interface based on the first identifier.

[0172] In another possible embodiment, the first application on the first terminal 201 is a system notification application 201B, and the second application on the second terminal 202 is a system notification application 202B. The system notification application 201B and the system notification application 202B are two different versions of the system notification application. For example, the system notification application 201B is an application with full functionality, and the system notification application 202B is an application without full functionality.

[0173] When the first terminal 201 and the second terminal 202 are within Bluetooth communication range, the system notification application 201B in the first terminal and the system notification application 202B in the second terminal 202 use Bluetooth near-field communication (NFC) connection to transmit data. The process of data transmission using Bluetooth NFC connection by system notification applications 201B and 202B is similar to that described in the above embodiments, and therefore will not be repeated here.

[0174] S704, when the first terminal 201 and the second terminal 202 are not within the Bluetooth communication range, the first terminal 201 and the second terminal 202 establish a far-field communication connection, and the first application in the first terminal 201 and the second application in the second terminal 202 use the far-field communication connection to transmit data.

[0175] Specifically, in one possible implementation, the user carries the second terminal 202 away from the first terminal 201, causing the first terminal 201 and the second terminal 202 to be out of Bluetooth communication range, and the Bluetooth near-field communication connection between the first terminal 201 and the second terminal 202 is disconnected. In response to the disconnection of the Bluetooth near-field communication connection, the far-field communication module in the first terminal 201 and the far-field communication module in the second terminal 202 establish a far-field connection through the server 210.

[0176] In one possible embodiment, in response to the Bluetooth near-field communication connection being disconnected, the Bluetooth communication modules in the first terminal 201 and the second terminal 202 notify the corresponding switching modules that the Bluetooth near-field communication connection has been disconnected. The switching modules in the first terminal 201 and the second terminal 202 notify the corresponding far-field communication modules to establish a far-field connection with the peer device. Specifically, the far-field communication module in the first terminal 201 sends the communication address of the first terminal 201 to the server 210 and requests the communication address of the second terminal 202 from the server 210. At the same time, the far-field communication module in the second terminal 202 sends the communication address of the second terminal 202 to the server 210 and requests the communication address of the first terminal 201 from the server 210. The communication address includes an IP address and a port number, which are not limited in this application. The server 210 sends the received communication address of the second terminal 202 to the first terminal 201 and simultaneously sends the received communication address of the first terminal 201 to the second terminal 202. Based on the received communication address of the peer device, the first terminal 201 and the second terminal 202 establish a TCP connection or a UDP connection. In this way, the first terminal 201 and the second terminal 202 can communicate with each other in a peer-to-peer (P2P) manner through the communication address of the peer device, thereby realizing direct communication between the first terminal 201 and the second terminal 202. It can be understood that the communication address in this step is a far-field communication address.

[0177] In another possible implementation, based on the received communication address of the peer device, server 210 acts as a relay server, and the first terminal 201 and the second terminal 202 establish a TCP or UDP connection through server 210. In this way, the first terminal 201 and the second terminal 202 can communicate with each other via the relay provided by server 210.

[0178] It should be noted that when the far-field communication connection between the first terminal 201 and the second terminal 202 is established, the far-field communication modules on the first terminal 201 and the second terminal 202 store the communication address of the peer device. When the far-field communication modules on the first terminal 201 and the second terminal 202 receive a data packet from the peer device, they send the data packet to the corresponding switching module. Simultaneously, the switching modules on the first terminal 201 and the second terminal 202 maintain the currently available communication link between the first terminal 201 and the second terminal 202 as a far-field communication connection. Furthermore, the switching modules in the first terminal 201 and the second terminal 202 also maintain the communication address of the peer device in this far-field communication connection. Specifically, the information maintained by the switching module of the first terminal 201 is shown in Table 3, and the information maintained by the switching module of the second terminal 202 is shown in Table 4. Tables 3 and 4 show the information maintained by the switching modules of the first terminal 201 and the second terminal 202, which may also include other information; this embodiment does not limit this information.

[0179] peer equipment Available communication links Communication address of the peer device Second Terminal 202 Far-field communication connection XX.XX.XX.XX

[0180] Table 3

[0181] peer equipment Available communication links Communication address of the peer device First Terminal 201 Far-field communication connection XX.XX.XX.XX

[0182] Table 4

[0183] In one possible implementation, the switching module of the first terminal 201 sends the communication address of the peer device, i.e. the communication address of the second terminal 202, to the far-field communication module of the first terminal 201. The switching module of the first terminal 201 then establishes a far-field communication connection with the second terminal 202 based on the communication address of the second terminal 202.

[0184] The far-field communication modules in the first terminal 201 and the second terminal 202 may include cellular communication modules or Wi-Fi communication modules. In one possible implementation, taking a Wi-Fi communication module in the first terminal 201 and a cellular communication module in the second terminal 202 as an example, the first terminal 201 uses the Wi-Fi communication module and the second terminal 202 uses the cellular communication module to establish a far-field connection. This far-field connection may also include other network element devices, such as routers and base stations; however, this application embodiment does not limit this.

[0185] In one possible embodiment, taking the sending of data from an instant messaging application 201A on a first terminal 201 to an instant messaging application 202A on a second terminal 202 as an example, a first far-field communication transmission channel is established between the instant messaging application 201A on the first terminal 201 and the instant messaging application 202A on the second terminal 202, and a binding relationship is established between the first far-field communication transmission channel and a first Bluetooth transmission channel. The first far-field communication transmission channel can be a UDP transmission channel or a TCP transmission channel established based on the far-field communication connection 204. The instant messaging application 201A on the first terminal 201 calls the near-field communication application interface, i.e., the Bluetooth communication application interface, to send application data and device information of the second terminal 202 to the Bluetooth communication application interface. The Bluetooth communication application interface on the first terminal 201 calls the switching module to send application data to the switching module. The switching module on the first terminal 201 queries the peer device information to obtain that the currently usable communication link between the first terminal 201 and the second terminal 202 is a far-field communication connection, and the communication address of the peer device in this far-field communication connection, i.e., the communication address of the second terminal 202. Therefore, the switching module on the first terminal 201 calls the far-field communication module, i.e., the Wi-Fi communication module, to send the application data and the communication address of the second terminal 202 to the Wi-Fi communication module. The Wi-Fi communication module on the first terminal 201 generates data to be sent based on the communication address of the second terminal 202, the communication address of the first terminal 201, and the application data, and sends the data to be sent to the far-field communication module on the second terminal 202, i.e., the cellular communication module, through the first far-field communication transmission channel. The data to be sent includes application data, the source address (i.e., the communication address of the first terminal 201), and the destination address (i.e., the communication address of the second terminal 202). When the cellular communication module on the second terminal 202 receives the data to be sent on the first far-field communication transmission channel, it parses the source address and application data, and determines that the sender of the data to be sent is the first terminal 201 based on the source address. It then sends the application data from the data to be sent to the near-field communication application interface, i.e., the Bluetooth communication application interface, through the switching module. The Bluetooth communication application interface sends the application data to the instant messaging application 202A based on the binding relationship between the first far-field communication transmission channel and the first Bluetooth transmission channel.

[0186] In one possible implementation, after the cellular communication module on the second terminal 202 receives the data to be transmitted on the first far-field communication transmission channel, it determines that the sender of the data to be transmitted is the first terminal 201 based on the source address in the data to be transmitted. Then, it directly sends the application data in the data to be transmitted to the Bluetooth communication application programming interface. This embodiment of the application does not limit this approach. The process of the instant messaging application 202A on the second terminal 202 sending data to the instant messaging application 201A on the first terminal 201 is similar to the above description, and this embodiment of the application will not elaborate further.

[0187] In one possible implementation, after the cellular communication module on the second terminal 202 receives the data to be transmitted on the first far-field communication transmission channel, it parses it to obtain the application data and the source address, i.e., the communication address of the first terminal 201. The cellular communication module on the second terminal 202 sends the application data and the source address to the handover module. The handover module on the second terminal 202 checks whether the source address is stored in the maintenance information. If the source address exists, the handover module on the second terminal 202 sends the application data to the Bluetooth communication application programming interface. If the source address does not exist, the handover module on the second terminal 202 sends the application data to the far-field communication application programming interface.

[0188] In one possible implementation, the handover module on the first terminal 201 queries the peer device information to determine that the currently available communication link between the first terminal 201 and the second terminal 202 is a far-field communication connection, and the communication address of the peer device in this far-field communication connection, i.e., the communication address of the second terminal 202. The handover module on the first terminal 201 adds a second identifier to the application data to generate second application data. The second identifier indicates that the application data is a far-field communication data type. The handover module on the first terminal 201 calls the far-field communication module, i.e., the Wi-Fi communication module, to send the second application data and the communication address of the second terminal 202 to the Wi-Fi communication module. The Wi-Fi communication module on the first terminal 201 generates data to be sent based on the communication address of the second terminal 202, the communication address of the first terminal 201, and the second application data, and sends the data to be sent to the far-field communication module on the second terminal 202, i.e., the cellular communication module, through the first far-field communication transmission channel. The data to be sent includes the second application data and the destination address, i.e., the communication address of the second terminal 202. When the cellular communication module on the second terminal 202 receives the data to be transmitted, it parses it to obtain the second application data and sends the second application data to the handover module. The handover module on the second terminal 202 parses the second application data to obtain the second identifier and application data, and sends the application data to the Bluetooth communication application interface according to the second identifier.

[0189] The process of data transmission using a far-field communication connection in system notification applications 201B and 202B is similar to that described in the above embodiments, and therefore will not be repeated here.

[0190] It should be noted that, in one possible implementation, in response to a Bluetooth near-field connection disconnection, if the far-field connection between the first terminal 201 and the second terminal 202 fails to be established successfully within a preset time period, the switching module in the first terminal 201 notifies the first application that the Bluetooth near-field connection is unavailable via the Bluetooth communication application programming interface (API). Simultaneously, the switching module in the second terminal 202 notifies the second application that the Bluetooth near-field connection is unavailable via the Bluetooth communication API. If the far-field connection between the first terminal 201 and the second terminal 202 is successfully established within the preset time period, the switching module in the first terminal 201 does not notify the first application that the Bluetooth near-field connection is unavailable; that is, the switching module blocks the Bluetooth near-field connection from being available to the first application. Similarly, the switching module in the second terminal 202 does not notify the second application that the Bluetooth near-field connection is unavailable; that is, the switching module blocks the Bluetooth near-field connection from being available to the second application.

[0191] In another possible implementation, in response to a Bluetooth near-field connection loss, the switching module in the first terminal 201 directly notifies the first application that the Bluetooth near-field connection is unavailable via the Bluetooth communication application programming interface (API). Simultaneously, the switching module in the second terminal 202 directly notifies the second application that the Bluetooth near-field connection is unavailable via the Bluetooth communication API. When a far-field connection is successfully established between the first terminal 201 and the second terminal 202, the switching module in the first terminal 201 notifies the first application that the Bluetooth near-field connection is normal via the Bluetooth communication API. Simultaneously, the switching module in the second terminal 202 notifies the second application that the Bluetooth near-field connection is normal via the Bluetooth communication API.

[0192] It should be noted that when the first terminal 201 and the second terminal 202 fail to transmit data directly using the far-field communication module, the first terminal 201 and the second terminal 202 can use the far-field communication module to forward data through the server 210, thereby realizing the data transmission function between the first terminal 201 and the second terminal 202. This application embodiment does not limit the specific method of data transmission using the far-field communication connection.

[0193] S705, when the first terminal 201 and the second terminal 202 are back within Bluetooth communication range, the first terminal 201 and the second terminal 202 establish a Bluetooth near-field communication connection and disconnect the far-field connection between the first terminal 201 and the second terminal 202. The first application in the first terminal 201 and the second application in the second terminal 202 use the Bluetooth near-field connection to transmit data.

[0194] Specifically, in one possible implementation, the user brings the second terminal 202 close to the first terminal 201. The first terminal 201 and the second terminal 202 are once again within Bluetooth communication range. The Bluetooth communication modules in the first terminal 201 and the second terminal 202 establish a Bluetooth near-field communication connection and disconnect the far-field connection between the first terminal 201 and the second terminal 202. Specifically, the far-field communication modules in the first terminal 201 and the second terminal 202 disconnect the established TCP or UDP transmission channel. In one possible implementation, in response to the establishment of the Bluetooth near-field connection, the switching module in the first terminal 201 notifies the far-field communication module to disconnect the far-field connection, and the switching module in the second terminal 202 also notifies the far-field communication module to disconnect the far-field connection. Further, when a Bluetooth near-field communication connection is established between the first terminal 201 and the second terminal 202, the switching modules on the first terminal 201 and the second terminal 202 maintain the currently available communication link between the first terminal 201 and the second terminal 202 as the Bluetooth near-field communication connection, as shown in Tables 1 and 2.

[0195] The process of the first application in the first terminal 201 and the second application in the second terminal 202 transmitting data using Bluetooth near-field connection can be referred to the description of step S703, and will not be repeated here.

[0196] In one possible implementation, a near-field communication connection 203 and a far-field communication connection 204 can exist simultaneously between the first terminal 201 and the second terminal 202. A first Bluetooth communication transmission channel and a first far-field communication transmission channel can be established simultaneously between the instant messaging application 201A in the first terminal 201 and the instant messaging application 202A in the second terminal 202. The switching module in the first terminal 201 can simultaneously use the first Bluetooth communication transmission channel and the first far-field communication transmission channel to send the same data to the second terminal 202. This increases the reliability of data transmission between the first terminal 201 and the second terminal 202. In another possible implementation, the switching module in the first terminal 201 can simultaneously use the first Bluetooth communication transmission channel and the first far-field communication channel to send different data to the second terminal 202. This improves the efficiency of data transmission between the first terminal 201 and the second terminal 202.

[0197] In another possible implementation, the first application in the first terminal 201 and the second application in the second terminal 202 can be the same version of the same application. For example, both the first terminal and the second terminal are mobile phones, so that the same application between mobile phones can transmit data through both near-field communication and far-field communication connections, increasing the reliability and flexibility of data transmission between mobile phones.

[0198] from Figure 7 As can be seen from the given embodiments, in this application embodiment, the first terminal 201 and the second terminal 202 do not need to make any modifications to the first application and the second application. Only by modifying the implementation of the near-field communication application interface, the first terminal 201 and the second terminal 202 can complete the data transmission between the first terminal 201 and the second terminal 202 by using a near-field communication connection or a far-field communication connection through a switching module, depending on the near-field communication conditions. In this way, only the application interface of the terminal device system needs to be modified, without modifying the implementation of each application individually, so that the second application on the second terminal 202 can achieve complete application functions, that is, data synchronization can be achieved without relying on the first terminal 201 being nearby.

[0199] In this embodiment of the application, the first terminal 201 may have a setting function, which can enable the far-field data transmission function of the first application in the first terminal 201 in the Bluetooth settings interface.

[0200] Please refer to Figure 8a For example, the Bluetooth settings interface 802 of the first terminal 201 includes one or more controls. These controls include, but are not limited to, a Bluetooth control 804, a battery control, and a network control. For example, a user can click the Bluetooth control 804 to enable the Bluetooth function.

[0201] For example, the first terminal 201, in response to a received user operation, enables the Bluetooth function. Please refer to... Figure 8b For example, the first terminal 201 may display a Bluetooth icon on the network control of the Bluetooth settings interface 802 to indicate that the Bluetooth function has been enabled. The Bluetooth settings interface 802 displays paired devices 806 and available devices 808, wherein the devices displayed in the available devices 808 are Bluetooth devices scanned by the first terminal 201, but have not yet completed Bluetooth pairing with the first terminal 201. The paired devices 806 include the second terminal 202, and in response to the user clicking the control 810 to the right of the second terminal 202 icon, the user enters the settings interface of the second terminal 202.

[0202] Figure 8cAn example is shown of the settings interface 812 of the second terminal 202, which includes a far-field data transmission control 814, etc. For example, a user can click the far-field data transmission control 814 to enable the far-field data transmission function between the first terminal 201 and the second terminal 202. Specifically, the far-field data transmission function refers to the function that supports a first application in the first terminal to use a far-field communication connection to transmit data with a second application in the second terminal.

[0203] For example, in response to a received user operation, the first terminal 201 enables the far-field data transmission function of the second terminal 202. Please refer to... Figure 8d The settings interface 812 of the second terminal 202 includes a far-field data transmission control 814, a selectable list of far-field data transmission applications, and an application addition control 816, etc. The far-field data transmission control 814 indicates that the far-field data transmission function is enabled. The selectable list of far-field data transmission applications includes an instant messaging application 818, and the user can also click the application addition control 814 to add other applications to the selectable list of far-field data transmission applications. In response to the instant messaging application 818 having enabled far-field data transmission, the instant messaging application 201A in the first terminal 201 and the instant messaging application 202A in the second terminal 202 can execute the data transmission method provided in this embodiment to complete the data transmission function between the instant messaging application 201A and the instant messaging application 202A.

[0204] In one possible implementation, in response to the user, for example... Figure 8c In the settings interface 812 shown, clicking the far-field data transmission control 814 will display, for example, the first terminal 201. Figure 8e The settings interface 822 of the second terminal 202 is shown. The status bar of the settings interface 822 of the second terminal 202 displays a far-field data transmission icon 824, which indicates that the far-field data transmission function of the first terminal 201 has been enabled. When the user clicks the far-field data transmission control 826 to disable the far-field data transmission function between the first terminal 201 and the second terminal 202, the first terminal 201 displays, for example... Figure 8c The settings interface 812 of the second terminal 202 shown here has the far-field data transmission icon cleared from the status bar.

[0205] In one possible implementation, the first terminal 201 can replace the Bluetooth icon in the status bar with another Bluetooth icon to indicate that the first terminal 201 has enabled far-field data transmission. Please refer to... Figure 8eAnother Bluetooth icon 834 displayed in the status bar of the settings interface 832 of the second terminal 202 is used to indicate that the far-field data transmission function of the first terminal 201 has been enabled. It should be noted that this application does not limit the icon used to indicate the far-field data transmission function.

[0206] In another possible embodiment, the first terminal 201 may have a setting function that enables the far-field data transmission function of the first application in the sports and health application to be turned on.

[0207] Figure 9a An exemplary illustration shows the main interface 902 displayed on the first terminal 201. This interface 902 displays a page with application icons, including multiple icons (e.g., clock, calendar, gallery, memo, file manager, browser, camera, etc.). Below the application icons is a page indicator 908 indicating the positional relationship between the currently displayed page and other pages. Below the page indicator are multiple tray icons, which remain displayed during page switching. In some embodiments, the page may also include multiple application icons and a page indicator. The page indicator may not be part of the page and may exist independently. The application icons are also optional, and this embodiment does not impose limitations on this. A status bar 904 is displayed in the upper part of the interface 902. The status bar 904 may include one or more signal strength indicators for mobile communication signals (also known as cellular signals), a battery status indicator, a time indicator, etc. When the terminal enables Bluetooth, a Bluetooth enable indicator may also be displayed in the status bar 904. Users can operate the terminal using preset gestures, such as returning to the main interface or displaying open applications. This application does not limit the specific gestures used. In addition to gesture operations, the terminal can also perform related operations using virtual or physical buttons. For example, clicking the "Health" icon 906 will take the user to the Health application interface.

[0208] Figure 9bAn exemplary interface 912 of a sports and health application is shown, which includes a sports parameter display area and a menu bar. The sports parameter display area can be used to display today's sports data, such as distance, calories burned, and steps taken. It can also display recent sports and health data, such as exercise records, heart rate, and weight. The menu bar can include a health icon, a sports icon, a device icon 914, and a "My" icon. The health icon displays the sports parameter display area, i.e., the sports parameter display area of ​​the sports and health interface 912. The sports icon can be used to switch the display of the sports details area, which offers different sports modes that users can select. The device icon 914 can be used to switch the display of the device details area, which displays other electronic devices connected to the first terminal 201. Users can use the function controls provided in the device details area to delete, connect, or configure these electronic devices. The "My" icon can be used to switch the display of the personal information area. Clicking the device icon 914 takes the user to the device details display area.

[0209] Figure 9c An exemplary illustration shows a device details display area interface 922 of a sports and health application. This interface 922 includes other electronic devices connected to the first terminal 201. For example, the device details display area interface 922 displays an icon 924 for the second terminal 202. The user clicks icon 924 to enter the settings interface of the second terminal 202.

[0210] Figure 9d An example is shown of the settings interface 932 of the second terminal 202, which includes a far-field data transmission control 934, etc. For example, a user can click the far-field data transmission control 934 to enable the far-field data transmission function between the first terminal 201 and the second terminal 202.

[0211] For example, in response to a received user operation, the first terminal 201 enables the far-field data transmission function of the second terminal 202. Please refer to... Figure 9eThe settings interface 932 of the second terminal 202 includes a far-field data transmission control 934, a selectable list of far-field data transmission applications, and an application addition control 936, etc. The far-field data transmission control 934 indicates that the far-field data transmission function is enabled. The selectable list of far-field data transmission applications includes an instant messaging application 938, and the user can also click the application addition control 936 to add other applications to the selectable list of far-field data transmission applications. In response to the instant messaging application 938 having its far-field data transmission function enabled, the instant messaging application 201A in the first terminal 201 and the instant messaging application 202A in the second terminal 202 can execute the data transmission method provided in this application embodiment to complete the data transmission function between the instant messaging application 201A and the instant messaging application 202A. The display of the far-field data transmission function icon can be found in [reference needed]. Figure 8e and 8f As shown, it will not be elaborated further here.

[0212] It should be noted that, as Figure 8c As shown in Figure 9d, in response to a user clicking the far-field data transmission control 814 or 934, the first terminal 201 sends a first message to the second terminal 202. This first message notifies the second terminal 202 to enable the far-field data transmission function. The first message carries the device address of the second terminal 202 and a list of far-field data transmission applications. This application list may include a first application in the first terminal 201 or a second application in the second terminal 202. Upon receiving the first message, the second terminal 202 enables the far-field data transmission function. In one possible implementation, after enabling the far-field data transmission function, the second terminal 202 sends a second message to the first terminal 201. This second message notifies the first terminal 201 that the far-field data transmission function has been successfully enabled. The first and second messages can be transmitted via a near-field communication connection or relayed through a server; this embodiment does not limit the transmission method.

[0213] In one possible implementation, after receiving the first message sent by the first terminal 201, the second terminal 202 displays a first prompt message to the user that the second terminal 202 has enabled the far-field data transmission function. In one example, the second terminal 202 displays a prompt box indicating to the user that "far-field data transmission function has been enabled." Optionally, a "cancel" control and a countdown prompt box are also displayed within the prompt box. Clicking the "cancel" control can be understood as the second terminal 202 refusing to enable the far-field data transmission function, and the countdown prompt box is used to remind the user that if the "cancel" control is not clicked within a preset time, it means that the second terminal 202 agrees to enable the far-field data transmission function. The preset time can be 3 seconds, but this embodiment does not limit it.

[0214] In one possible implementation, after the first terminal 201 receives the second message sent by the second terminal 202, the first terminal 201 displays a second prompt message, which is used to prompt the user that the second terminal 202 has enabled the far-field data transmission function.

[0215] In another possible embodiment, the second terminal 202 may have a setting function that enables the far-field data transmission function of the second application in the second terminal 202 to be enabled in the settings application.

[0216] Please refer to Figure 10a For example, the Bluetooth settings interface 1002 of the second terminal 202 includes a Bluetooth control 1004. For example, a user can click the Bluetooth control 1004 to enable the Bluetooth function.

[0217] For example, the second terminal 202, in response to a received user operation, enables the Bluetooth function. Please refer to... Figure 10b For example, the second terminal 202 displays paired devices 1006 and available devices 1008 in the Bluetooth settings interface 1002. The devices displayed in the available devices 1008 are Bluetooth devices scanned by the second terminal 202, but have not yet completed Bluetooth pairing with the second terminal 202. The paired devices 1006 include the first device 201. In response to the user clicking the control 1010 to the right of the first terminal 201 icon, the user enters the settings interface of the first terminal 201.

[0218] Figure 10c The example shown is a settings interface 1012 of the first terminal 201, which includes a far-field data transmission control 1014, etc. For example, a user can click the far-field data transmission control 1014 to enable the far-field data transmission function of the first terminal 201.

[0219] For example, in response to a received user operation, the second terminal 202 enables the far-field data transmission function of the first terminal 201. Please refer to... Figure 10d The settings interface 1012 of the first terminal 201 includes a far-field data transmission control 1014, a selectable list of far-field data transmission applications, and an application addition control 1016, etc. The far-field data transmission control 1014 indicates that the far-field data transmission function is enabled. The selectable list of far-field data transmission applications includes an instant messaging application 1018, and the user can also click the application addition control 1014 to add other applications to the selectable list of far-field data transmission applications. In response to the activation of the far-field data transmission function in the instant messaging application 1018, the instant messaging application 202A in the second terminal 202 and the instant messaging application 201A in the first terminal 201 can execute the data transmission method provided in this embodiment to complete the data transmission function between the instant messaging application 202A and the instant messaging application 201A.

[0220] In one possible embodiment, the first terminal 201 includes an instant messaging application 201A and a system notification application 201B, and the second terminal 202 includes an instant messaging application 202A and a system notification application 202B. Instant messaging application 201A and instant messaging application 202A are two different versions of the instant messaging application, and system notification application 201B and system notification application 202B are two different versions of the system notification application. In one possible embodiment, the instant messaging application has far-field data transmission enabled, while the system notification application has not, such as... Figure 8d As shown, instant messaging applications are in the optional list of far-field communication applications, while system notification applications are not.

[0221] When the first terminal 201 and the second terminal 202 are within Bluetooth communication range, the switching module on the first terminal 201 and the second terminal 202 maintains the currently available communication link between the first terminal 201 and the second terminal 202 as a Bluetooth communication connection, as described in Tables 1 and 2 above. At this time, data transmission between instant messaging applications 201A and 202A, and between system notification applications 201B and 202B, is completed using the Bluetooth communication connection. The specific data transmission method is described in step S703 and will not be repeated here.

[0222] When the first terminal 201 and the second terminal 202 are not within Bluetooth communication range, the switching module on the first terminal 201 and the second terminal 202 maintains the available communication link between the current instant messaging application 201A and the instant messaging application 202A as a far-field communication connection. Since the system notification application has not enabled far-field data transmission, the switching module on the first terminal 201 and the second terminal 202 maintains the communication link between the current system notification application 201B and the system notification application 202B as unavailable. Specifically, the information maintained by the switching module of the first terminal 201 is shown in Table 5, and the information maintained by the switching module of the second terminal 202 is shown in Table 6. Tables 5 and 6 provide information maintained by the switching modules of the first terminal 201 and the second terminal 202, and may also include other information; this embodiment does not limit this information.

[0223] peer equipment app Available communication links Communication address of the peer device Second Terminal 202 Instant messaging applications Far-field communication connection XX.XX.XX.XX Second Terminal 202 System notification application none none

[0224] Table 5

[0225] peer equipment app Available communication links Communication address of the peer device First Terminal 201 Instant messaging applications Far-field communication connection XX.XX.XX.XX First Terminal 201 System notification application none none

[0226] Table 6

[0227] In one possible implementation, when the first terminal 201 and the second terminal 202 are not within Bluetooth communication range, in response to the disconnection of the Bluetooth communication connection between the first terminal 201 and the second terminal 202, the switching module in the first terminal 201 notifies the system notification application 201B that the Bluetooth near-field connection is unavailable via the Bluetooth communication application interface. The switching module in the second terminal 202 also notifies the system notification application 202B that the Bluetooth near-field connection is unavailable via the Bluetooth communication application interface. At this time, data transmission is completed between the instant messaging application 201A and the instant messaging application 202A using a far-field communication connection, while data transmission is impossible between the system notification application 201B and the system notification application 202B.

[0228] In one possible implementation, such as Figure 8d As shown, users can click the application add control 814 to add a system notification application to the selectable list of far-field data transmission applications. In response to the add operation, the settings interface of the second terminal 202 displayed on the first terminal 201 is as follows: Figure 11 As shown, both the instant messaging application and the system notification application are in the list of available far-field communication applications, indicating that far-field data transmission functionality has been enabled for both applications.

[0229] When the first terminal 201 and the second terminal 202 are within Bluetooth communication range, the switching module on the first terminal 201 and the second terminal 202 maintains the currently available communication link between the first terminal 201 and the second terminal 202 as a Bluetooth communication connection, as shown in Tables 1 and 2 above. At this time, data transmission between instant messaging applications 201A and 202A, and between system notification applications 201B and 202B, is completed using Bluetooth communication connections. The specific data transmission method is described in step S703 and will not be repeated here.

[0230] When the first terminal 201 and the second terminal 202 are not within Bluetooth communication range, the switching modules on the first terminal 201 and the second terminal 202 maintain the available communication link between the current instant messaging application 201A and the instant messaging application 202A as a far-field communication connection. Simultaneously, the switching modules on the first terminal 201 and the second terminal 202 maintain the available communication link between the current system notification application 201B and the system notification application 202B as a far-field communication connection. Specifically, the information maintained by the switching module of the first terminal 201 is shown in Table 7, and the information maintained by the switching module of the second terminal 202 is shown in Table 8. Tables 7 and 8 provide information maintained by the switching modules of the first terminal 201 and the second terminal 202, which may also include other information; this embodiment does not limit this. At this time, data transmission between instant messaging applications 201A and 202A, and between system notification applications 201B and 202B, is completed using far-field communication connections. The specific data transmission method is described in step S704 and will not be repeated here.

[0231] peer equipment app Available communication links Communication address of the peer device Second Terminal 202 Instant messaging applications Far-field communication connection XX.XX.XX.XX Second Terminal 202 System notification application Far-field communication connection XX.XX.XX.XX

[0232] Table 7

[0233] peer equipment app Available communication links Communication address of the peer device First Terminal 201 Instant messaging applications Far-field communication connection XX.XX.XX.XX First Terminal 201 System notification application Far-field communication connection XX.XX.XX.XX

[0234] Table 8

[0235] In one possible implementation, when the first terminal 201 and the second terminal 202 are not within Bluetooth communication range, after the first terminal 201 and the second terminal 202 successfully establish a far-field communication connection, a third prompt message is displayed on the first terminal 201. This third prompt message is used to inform the user that the far-field data transmission function in the first terminal 201 is active. In one example, the third prompt message may be as follows: Figure 8e The far-field data transmission icon 824 or as shown in the image. Figure 8fThe far-field data transmission icon 834 in this embodiment is not limited thereto. That is, in this implementation, when the first terminal 201 enables the far-field data transmission function, the first terminal 201 does not display the far-field data transmission icon 834. Figure 8e The far-field data transmission icon 824 or as shown in the image. Figure 8f The far-field data transmission icon 834 is not displayed on the first terminal 201, but only when the first terminal 201 and the second terminal 202 successfully establish a far-field communication connection. Figure 8e The far-field data transmission icon 824 or as shown in the image. Figure 8f The far-field data transmission icon 834 is shown in the image. It should be noted that the first terminal 201 can also notify the user that the far-field data transmission function is active in other ways. In one example, the first terminal 201 can display a card indicating that the far-field data transmission function is in use in the notification center of the negative one screen and / or drop-down menu. The user can use this card to turn off the far-field data transmission function, thus causing the first terminal 201 to terminate the far-field data transmission function.

[0236] In one possible implementation, when the first terminal 201 and the second terminal 202 are not within Bluetooth communication range, after the first terminal 201 and the second terminal 202 successfully establish a far-field communication connection, a fourth prompt message is displayed on the second terminal 202. This fourth prompt message is used to inform the user that the far-field data transmission function in the second terminal 202 has been activated. The information displayed on the second terminal 202 can be referred to the description of the first terminal 201 above, and will not be repeated here.

[0237] In one possible embodiment, such as Figure 8c As shown, after the user clicks the far-field data transmission control 814 to enable the far-field data transmission function of the second terminal 202, the far-field data transmission function of all applications is enabled by default. In response to enabling the far-field data transmission function of the second terminal 202, the data transmission process between the first application in the first terminal 201 and the second application in the second terminal 202 is as described in the above embodiment and will not be repeated here. It should be noted that in this scenario, in response to the user clicking the far-field data transmission control 714, the first message sent by the first terminal 201 to the second terminal 202 may not include the list of far-field data transmission applications. After receiving the first message, the second terminal 202 enables the far-field data transmission function of all applications.

[0238] based on Figure 5The software architecture of the first terminal 201 and the second terminal 202 provided in the embodiment of this application is shown. Another possible implementation is provided in this embodiment: when the first terminal 201 and the second terminal 202 are within the near-field communication range, the first terminal 201 and the second terminal 202 establish a near-field communication connection 203, and the first application of the first terminal 201 calls the near-field communication application interface and the second application of the second terminal 202 to perform data transmission; when the first terminal 201 and the second terminal 202 are not within the near-field communication range, the first terminal 201 and the second terminal 202 establish a far-field communication connection 204, and the first application of the first terminal 201 calls the far-field communication application interface and the second application of the second terminal 202 to perform data transmission.

[0239] In one possible embodiment, Figure 4 The network architecture shown also includes a third terminal 203, which can be a smart terminal such as VR glasses or in-vehicle equipment. This application embodiment does not limit this. Figure 12 This example illustrates another network architecture provided by an embodiment of this application. The first terminal 201 and the third terminal 203 can establish a near-field communication connection 206 or a far-field communication connection 207. The near-field communication connection 206 may include a Bluetooth communication connection or a Wi-Fi Direct communication connection, while the far-field communication connection 207 may include a Wi-Fi communication connection or a cellular communication connection. When the first terminal 201 and the third terminal 203 are within the near-field communication range, the first application in the first terminal 201 completes data transmission with the third application in the third terminal 203 through the near-field communication connection 206. When the first terminal 201 and the third terminal 203 are outside the near-field communication range, the first application in the first terminal 201 completes data transmission with the third application in the third terminal 203 through the far-field communication connection 207. The specific data transmission process is as described in the above embodiment and will not be repeated here. The first application in the first terminal 201 and the third application in the third terminal 207 are two different versions of the same application.

[0240] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0241] This application provides a first terminal, such as... Figure 13As shown, the first terminal includes one or more processors 1301 and one or more memories 1302. The one or more memories 1302 store one or more computer programs, which include instructions. When the instructions are executed by the one or more processors 1301, the technical solution executed by the first terminal in the above embodiments is performed. Its implementation principle and technical effects are similar to those in the related embodiments of the above methods, and will not be repeated here.

[0242] This application provides a second terminal, such as... Figure 14 As shown, the first terminal includes one or more processors 1401 and one or more memories 1402. The one or more memories 1402 store one or more computer programs, which include instructions. When the instructions are executed by the one or more processors 1401, the technical solution executed by the second terminal in the above embodiments is performed. Its implementation principle and technical effects are similar to those in the related embodiments of the above methods, and will not be repeated here.

[0243] This application also provides a data transmission system, which includes a first terminal and a second terminal. The first terminal is configured to execute the methods executed by the first terminal in the above embodiments, and the second terminal is configured to execute the methods executed by the second terminal in the above embodiments.

[0244] This application provides a computer program product that, when run on a first terminal or a second terminal, causes the first terminal or the second terminal to execute the technical solution described in the above embodiments. Its implementation principle and technical effects are similar to those of the related embodiments described above, and will not be repeated here.

[0245] This application provides a readable storage medium containing instructions that, when executed by a first terminal or a second terminal, cause the first terminal or the second terminal to perform the technical solution described in the above embodiments. The implementation principle and technical effects are similar and will not be repeated here.

[0246] This application provides a chip for executing instructions. When the chip is running, it executes the technical solutions described in the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here.

[0247] In the embodiments of this application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0248] In the embodiments of this application, the memory can be non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SS), or it can be volatile memory, such as random-access memory (RAM). Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, and is not limited thereto.

[0249] The memory in the embodiments of this application can also be a circuit or any other device capable of performing storage functions, used to store program instructions and / or data. The methods provided in the various embodiments of this application can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, network equipment, user equipment, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disk, hard disk, magnetic tape), optical media (e.g., digital video disc (DWD), or semiconductor media (e.g., SSD), etc.

[0250] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features.

[0251] Furthermore, the various technologies, systems, devices, methods, and technical features described in the above embodiments can be combined to form other modules, methods, devices, systems, and technologies that do not depart from the spirit and principle of non-invention. These modules, methods, devices, systems, and technologies combined according to the embodiments of the present invention are all within the protection scope of the present invention.

Claims

1. A method for data transmission, characterized in that, The method includes: The first terminal and the second terminal are paired using near-field communication. The first terminal has a first application installed, and the second terminal has a second application installed. The first application and the second application belong to the same application. The first terminal includes a first near-field communication application interface. When the first terminal and the second terminal are within the near-field communication range, the first terminal and the second terminal establish a near-field communication connection, and the first application of the first terminal uses the near-field communication connection to perform data transmission with the second application of the second terminal; When the first terminal and the second terminal are not within the near-field communication range, the first terminal and the second terminal establish a far-field communication connection. The first application of the first terminal calls the first near-field communication application interface and uses the far-field communication connection and the second application of the second terminal to perform data transmission.

2. The method according to claim 1, characterized in that, The first application and the second application are different versions of the same application.

3. The method according to claim 1 or 2, characterized in that, The method further includes: The first terminal receives the user's first operation; In response to the first operation, the function of enabling the first application of the first terminal to perform data transmission using the far-field communication connection and the second application of the second terminal is activated.

4. The method according to claim 1 or 2, characterized in that, The method further includes: The first terminal displays a first interface, which includes a selectable list of far-field data transmission applications, including the first application.

5. The method according to claim 1 or 2, characterized in that, After the first terminal and the second terminal establish a far-field communication connection, the method further includes: The first terminal displays a third prompt message, which is used to notify the user that the far-field data transmission function of the first terminal has been activated.

6. The method according to claim 3, characterized in that, The method further includes: In response to the first operation, the first terminal sends a first message to the second terminal, the first message being used to instruct the second terminal to activate the function of the second application supporting the second terminal to perform far-field data transmission using a far-field communication connection.

7. The method according to claim 6, characterized in that, The first message also includes a list of applications, which includes the first application of the first terminal.

8. The method according to claim 6 or 7, characterized in that, The first terminal sends the first message through the near-field communication connection.

9. The method according to any one of claims 1-2 and 6-7, characterized in that, The first terminal includes a first near-field communication module, and the second terminal includes a second near-field communication module. The first terminal and the second terminal establish a near-field communication connection, including: The first near-field communication module of the first terminal establishes a near-field communication connection with the second near-field communication module of the second terminal based on the near-field communication address of the second terminal.

10. The method according to any one of claims 1-2 and 6-7, characterized in that, The method further includes: The first terminal and the second terminal disconnect the near-field communication connection. In response to disconnecting the near-field communication connection, the first terminal further includes a first switching module and a first far-field communication module. The first switching module instructs the first far-field communication module and the second far-field communication module of the second terminal to establish the far-field communication connection.

11. The method according to claim 10, characterized in that, The first switching module instructs the first far-field communication module and the second far-field communication module of the second terminal to establish the far-field communication connection, including: The first switching module sends the first communication address to the first far-field communication module. The first far-field communication module establishes the far-field communication connection with the second far-field communication module of the second terminal based on the first communication address, wherein the first communication address is the far-field communication address of the second terminal.

12. The method according to claim 10, characterized in that, The method further includes: In response to the disconnection of the near-field communication connection, the first switching module notifies the first application that the near-field communication connection has been disconnected; In response to the establishment of the far-field communication connection between the first terminal and the second terminal, the first switching module notifies the first application that the near-field communication connection has been established.

13. The method according to claim 10, characterized in that, The method further includes: In response to the disconnection of the near-field communication connection, within a preset time period, when the first terminal and the second terminal successfully establish the far-field communication connection, the first switching module does not notify the first application that the near-field communication connection has been disconnected; when the first terminal and the second terminal fail to establish the far-field communication connection, the first switching module notifies the first application that the near-field communication connection has been disconnected.

14. The method according to any one of claims 1-2, 6-7, and 11-13, characterized in that, The near-field communication connection includes a Bluetooth communication connection or a Wi-Fi Direct communication connection, and the far-field communication connection includes a Wi-Fi communication connection or a cellular communication connection.

15. The method according to claim 1, characterized in that, When the first terminal and the second terminal are within the near-field communication range, the first terminal and the second terminal also establish the far-field communication connection. The first application of the first terminal simultaneously uses the near-field communication connection to communicate with the far-field communication connection and the second application of the second terminal to transmit data.

16. The method according to any one of claims 1-2, 6-7, 11-13, and 15, characterized in that, The first terminal includes a mobile phone or tablet, and the second terminal includes a smartwatch, smart glasses, or a smart vehicle system.

17. The method according to any one of claims 1-2, 6-7, 11-13, and 15, characterized in that, The first terminal includes a smartwatch, smart glasses, or a smart vehicle system, and the second terminal includes a mobile phone or a tablet.

18. A method for data transmission, characterized in that, The method includes: The second terminal and the first terminal are paired using near-field communication. The first terminal has a first application installed, and the second terminal has a second application installed. The first application and the second application belong to the same application. The second terminal includes a second near-field communication application interface. When the second terminal and the first terminal are within the near-field communication range, the second terminal and the first terminal establish a near-field communication connection, and the second application of the second terminal uses the near-field communication connection to perform data transmission with the first application of the first terminal; When the second terminal and the first terminal are not within the near-field communication range, the second terminal and the first terminal establish a far-field communication connection. The second application of the second terminal calls the second near-field communication application interface to transmit data with the first application of the first terminal through the far-field communication connection.

19. The method according to claim 18, characterized in that, The first application and the second application are different versions of the same application.

20. The method according to claim 18 or 19, characterized in that, After the second terminal and the first terminal establish a far-field communication connection, the method further includes: The second terminal displays a fourth prompt message, which is used to inform the user that the far-field data transmission function of the second terminal has been activated.

21. The method according to claim 18 or 19, characterized in that, The method further includes: The second terminal receives a first message from the first terminal, the first message being used to instruct the second terminal to activate the function of the second application supporting the second terminal to perform far-field data transmission using a far-field communication connection.

22. The method according to claim 21, characterized in that, In response to the received first message, the second terminal displays a first prompt message, which is used to prompt the user that the second terminal has enabled the far-field data transmission function.

23. The method according to claim 21, characterized in that, The first message also includes a list of applications, which includes the first application of the first terminal.

24. The method according to claim 21, characterized in that, The second terminal receives the first message through the near-field communication connection.

25. The method according to any one of claims 18-19 and 22-24, characterized in that, The first terminal includes a first near-field communication module, and the second terminal includes a second near-field communication module. The second terminal and the first terminal establish a near-field communication connection, including: The second near-field communication module of the second terminal establishes the near-field communication connection with the first near-field communication module of the first terminal based on the near-field communication address of the first terminal.

26. The method according to any one of claims 18-19 and 22-24, characterized in that, The second terminal and the first terminal establish a far-field communication connection, including: The second terminal and the first terminal disconnect the near-field communication connection. In response to disconnecting the near-field communication connection, the second terminal further includes a second switching module and a second far-field communication module. The second switching module instructs the second far-field communication module and the first far-field communication module of the first terminal to establish the far-field communication connection.

27. The method according to claim 26, characterized in that, The second switching module instructs the second far-field communication module and the first far-field communication module of the first terminal to establish the far-field communication connection, including: The second switching module sends the second communication address to the second far-field communication module. The second far-field communication module establishes the far-field communication connection with the first far-field communication module of the first terminal based on the second communication address, wherein the second communication address is the far-field communication address of the first terminal.

28. The method according to claim 26, characterized in that, The method further includes: In response to the disconnection of the near-field communication connection, the second switching module notifies the second application that the near-field communication connection has been disconnected; In response to the establishment of the far-field communication connection between the first terminal and the second terminal, the second switching module notifies the second application that the near-field communication connection has been established.

29. The method according to claim 26, characterized in that, The method further includes: In response to the disconnection of the near-field communication connection, within a preset time period, when the first terminal and the second terminal successfully establish the far-field communication connection, the second switching module does not notify the second application that the near-field communication connection has been disconnected; when the first terminal and the second terminal fail to establish the far-field communication connection, the second switching module notifies the second application that the near-field communication connection has been disconnected.

30. The method according to any one of claims 18-19, 22-24, and 27-29, characterized in that, The near-field communication connection includes a Bluetooth communication connection or a Wi-Fi Direct communication connection, and the far-field communication connection includes a Wi-Fi communication connection or a cellular communication connection.

31. The method according to claim 18, characterized in that, When the second terminal and the first terminal are within the near-field communication range, the second terminal and the first terminal also establish the far-field communication connection. The second application of the second terminal uses both the near-field communication connection and the far-field communication connection to transmit data with the first application of the first terminal.

32. The method according to any one of claims 18-19, 22-24, 27-29, and 31, characterized in that, The first terminal includes a mobile phone or tablet, and the second terminal includes a smartwatch, smart glasses, or a smart vehicle system.

33. The method according to any one of claims 18-19, 22-24, 27-29, and 31, characterized in that, The first terminal includes a smartwatch, smart glasses, or a smart vehicle system, and the second terminal includes a mobile phone or a tablet.

34. A method for data transmission, characterized in that, The method is applied to a first terminal and a second terminal, wherein the first terminal performs the method as described in any one of claims 1-17, and the second terminal performs the method as described in any one of claims 18-33.

35. A first terminal, characterized in that, include: One or more processors, one or more memories, the one or more memories storing one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the first terminal to perform the method as described in any one of claims 1-17.

36. A second terminal, characterized in that, include: One or more processors, one or more memories, the one or more memories storing one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the second terminal to perform the method as described in any one of claims 18-33.

37. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-33.

38. A chip, characterized in that, The chip includes a processor and a memory, the memory storing a computer program that, when executed by the processor, implements the method as described in any one of claims 1-33.

39. A data transmission system, characterized in that, It includes a first terminal and a second terminal, wherein the first terminal performs the method as described in any one of claims 1-17, and the second terminal performs the method as described in any one of claims 18-33.