Data transmission method and apparatus, electronic device, and storage medium

By establishing communication connections through the detection of touch or proximity events between devices, and directly transmitting data after obtaining and verifying the foreground application identifier of the other device, the problem of cumbersome data transmission operations between devices is solved, improving user experience and reducing the risk of accidental transmission of sensitive content.

CN122340166APending Publication Date: 2026-07-03VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
VIVO MOBILE COMM CO LTD
Filing Date
2026-04-30
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Data transfer between different devices is cumbersome and results in a poor user experience.

Method used

By detecting touch or proximity events between devices, a communication connection is established, the foreground application identifier of the other device is obtained, and data is directly transmitted after verification based on a whitelist, simplifying the data transmission process and precisely controlling permissions.

Benefits of technology

It simplifies the data transmission process between devices, improves the user experience, and effectively avoids the risk of accidentally sending sensitive content through whitelist verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122340166A_ABST
    Figure CN122340166A_ABST
Patent Text Reader

Abstract

The application discloses a data transmission method and device, electronic equipment and storage medium, and belongs to the technical field of data transmission. The data transmission method comprises the following steps: in the case that a touch event or a close event with a second device is detected, a communication connection with the second device is established; an application identifier of a foreground application of the second device is acquired; in the case that the application identifier is an application identifier in a whitelist stored in the first device, first data is sent to the second device based on the communication connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data transmission technology, specifically to a data transmission method, apparatus, electronic device, and storage medium. Background Technology

[0002] In related technologies, when users need to transfer data between different devices, such as transferring pictures and documents between a mobile phone and a computer, they typically need to first manually establish a communication connection via Bluetooth or a data cable. Then, they need to locate the folder on the computer where the data to be transferred is stored on the phone, manually copy or send the data to the corresponding folder on the computer, and finally import the data into the relevant editing interface on the computer to edit it. This process is relatively cumbersome and results in a poor user experience. Therefore, it is evident that data transfer between different devices in related technologies presents a cumbersome operational problem. Summary of the Invention

[0003] This application provides a data transmission method, apparatus, electronic device, and storage medium, which can solve the problem that the data transmission process between different devices is cumbersome in related technologies.

[0004] In a first aspect, a data transmission method is provided, applied to a first device, the method comprising:

[0005] Upon detecting a touch event or proximity event with the second device, a communication connection with the second device is established;

[0006] Obtain the application identifier of the foreground application of the second device;

[0007] If the application identifier is an application identifier in the whitelist stored in the first device, the first data is sent to the second device based on the communication connection.

[0008] Secondly, a data transmission method is provided, applied to a second device, the method comprising:

[0009] Upon detecting a touch event or proximity event with the first device, establish a communication connection with the first device;

[0010] Send the application identifier of the foreground application to the first device;

[0011] Receive the first data sent by the first device.

[0012] Thirdly, a data transmission apparatus is provided for use in a first device, the apparatus comprising:

[0013] The first connection module is used to establish a communication connection with the second device when a touch event or proximity event with the second device is detected.

[0014] The acquisition module is used to acquire the application identifier of the foreground application of the second device;

[0015] The first sending module is configured to send first data to the second device based on the communication connection when the application identifier is an application identifier in the whitelist stored in the first device.

[0016] Fourthly, a data transmission apparatus is provided for use in a second device, the apparatus comprising:

[0017] The second connection module is used to establish a communication connection with the first device when a touch event or proximity event with the first device is detected.

[0018] The second sending module is used to send the application identifier of the foreground application to the first device;

[0019] The receiving module is used to receive the first data sent by the first device.

[0020] Fifthly, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a program or instructions executable on the processor, the program or instructions, when executed by the processor, perform the steps of the method as described in the first or second aspect.

[0021] In a sixth aspect, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first or second aspect.

[0022] In a seventh aspect, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the steps of the method described in the first or second aspect.

[0023] Eighthly, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the method described in the first or second aspect.

[0024] In this embodiment, when a user needs to transfer data from the first device to the second device, a communication connection between the two devices can be established simply by triggering a touch or proximity event between them. Then, the application identifier of the foreground application on the second device is obtained, and a whitelist verification is performed based on the application identifier. If the verification passes, data can be directly transmitted to the second device based on the established communication connection. This simplifies the data transmission process between different devices. Furthermore, by performing whitelist verification before data transmission, transmission permissions can be precisely controlled, effectively mitigating the risk of accidentally sending sensitive content. Attached Figure Description

[0025] Figure 1 This is one of the flowcharts illustrating a data transmission apparatus provided in some embodiments of this application;

[0026] Figure 2 This is a second schematic flowchart of a data transmission device provided in some embodiments of this application;

[0027] Figure 3 This is the third of a flowchart illustrating a data transmission device provided in some embodiments of this application;

[0028] Figure 4 This is the fourth of several schematic flowcharts of a data transmission device provided in some embodiments of this application;

[0029] Figure 5 This is the fifth of several schematic flowcharts of a data transmission device provided in some embodiments of this application;

[0030] Figure 6 This is one of the interface diagrams of the data transmission device in some embodiments of this application;

[0031] Figure 7 This is a second schematic diagram of the interface of the data transmission device in some embodiments of this application;

[0032] Figure 8 Schematic diagrams of the structure of electronic devices provided for some embodiments of this application;

[0033] Figure 9 A schematic diagram of the hardware structure of an electronic device provided for some embodiments of this application. Detailed Implementation

[0034] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0035] The terms "first," "second," etc., used in this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, the first object can be one or more. Furthermore, "or" in this application indicates at least one of the connected objects. For example, the scope of protection for "A or B" covers at least three scenarios: Scenario 1: including A but not B; Scenario 2: including B but not A; Scenario 3: including both A and B. In addition, the terms "A and / or B," "at least one of A and B," and "at least one of A or B" also cover at least the above three scenarios. The character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0036] The data transmission method, apparatus, electronic device, and storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through some embodiments and application scenarios.

[0037] Please see Figure 1 , Figure 1 This is a flowchart illustrating a data transmission method provided in an embodiment of this application. The data transmission method is applied to a first device and includes the following steps:

[0038] Step 101: In the event of detecting a touch event or proximity event with the second device, establish a communication connection with the second device.

[0039] The aforementioned first device and second device can be various devices with data transmission capabilities. For example, in some embodiments of this application, both the first device and the second device are mobile phones. As another example, in some embodiments of this application, one of the first device and the second device is a tablet computer, and the other is a mobile phone. As another example, in some embodiments of this application, one of the first device and the second device is a tablet computer, and the other is a smartwatch. As another example, in some embodiments of this application, one of the first device and the second device is a laptop computer, and the other is a smartwatch, etc.

[0040] The aforementioned touch event can be an event generated when the first device and the second device physically touch. The proximity event can be an event generated when the first device and the second device hover at close range. The distance and duration of this close-range hovering can be set as needed. For example, in some embodiments of this application, close-range hovering between the first device and the second device can mean that the distance between them is less than or equal to 5mm, and the duration within this distance range is greater than 1 second. As another example, in some embodiments of this application, close-range hovering between the first device and the second device can mean that the distance between them is less than or equal to 5mm, and the duration within this distance range is greater than 3 seconds. As yet another example, in some embodiments of this application, close-range hovering between the first device and the second device can mean that the distance between them is less than or equal to 4mm, and the duration within this distance range is greater than 4 seconds. The specific settings can be customized as needed.

[0041] The touch or proximity event between the first device and the second device can be detected by a relevant near-field device in the first device, or by a relevant near-field device in the second device, or simultaneously by relevant near-field devices in both devices. It is understood that a communication connection can be established between the two devices upon detecting a touch or proximity event with the second device. The near-field device can be a component in the first device whose signal changes when another device touches or approaches it; for example, it can be various capacitive sensors.

[0042] The aforementioned communication connections may include various short-range communication channels, such as BLE control channels and Wi-Fi P2P data channels.

[0043] Step 102: Obtain the application identifier of the foreground application of the second device.

[0044] The acquisition of the application identifier of the foreground application of the second device can be either an application identifier actively acquired by the first device from the second device, or an application identifier passively received by the first device from the second device. Furthermore, the first device can acquire the application identifier of the foreground application of the second device based on the communication connection. For example, in some embodiments of this application, acquiring the application identifier of the foreground application of the second device can refer to receiving application information sent by the second device based on the communication connection, wherein the application information includes the application identifier of the foreground application in the second device.

[0045] The foreground application refers to the application running in the foreground of the second device after the second device establishes a communication connection with the first device. The foreground application can be any application on the second device.

[0046] In some embodiments of this application, the data transmission method can be used in scenarios where a user needs to insert first data from a first device into a foreground application on a second device. Based on this, in these embodiments, application information sent by the second device can be received before sending the first data to the second device to determine whether the foreground application has permission to access the first data. This facilitates precise control over transmission permissions and effectively avoids the risk of accidentally sending sensitive content.

[0047] The aforementioned application identifier can be any identifier that can represent the identity information of the foreground application, such as the package name or application name of the foreground application.

[0048] Step 103: If the application identifier is an application identifier in the whitelist stored in the first device, send the first data to the second device based on the communication connection.

[0049] It is understood that the whitelist may include application identifiers of various applications that have access to the first data. The user of the first device can configure and manage the whitelist; specifically, the user can customize the application identifiers in the whitelist, thus balancing flexibility and privacy control.

[0050] In some embodiments of this application, the application identifier in the whitelist can be an internal application within the enterprise. Typically, only internal personnel can install the application indicated by the application identifier in the whitelist. Thus, when relevant personnel within the enterprise transmit data using the method provided in the embodiments of this application, permission verification through the whitelist can prevent them from transmitting internal enterprise data to external applications, thereby avoiding data leakage.

[0051] In some embodiments of this application, the applications indicated by the application identifiers in the whitelist may include not only internal applications within the enterprise, but also other external applications that have been reviewed by relevant personnel. The specific settings can be configured as needed.

[0052] The aforementioned first data can be various types of transmittable data, such as images, text, video, audio, and other types of data. Specifically, the first data can be data selected by the user of the first device within the first device, or it can be data generated by the first device based on data selected by the user within the first device.

[0053] In this implementation, when a user needs to transfer data from the first device to the second device, a communication connection between the two devices can be established simply by triggering a touch or proximity event between them. Then, the application identifier of the foreground application on the second device is obtained, and a whitelist verification is performed based on the application identifier. If the verification passes, data can be directly transmitted to the second device based on the established communication connection. This simplifies the data transmission process between different devices. Furthermore, by performing whitelist verification before data transmission, transmission permissions can be precisely controlled, effectively mitigating the risk of accidentally sending sensitive content.

[0054] Optionally, sending the first data to the second device based on the communication connection includes:

[0055] Obtain the second data;

[0056] The second data is converted to the first data based on the data format supported by the foreground application, and then the first data is sent to the second device based on the communication connection.

[0057] The method for determining the second data can be set as needed. For example, the second data can be data pre-selected by the user. Alternatively, the second data can be data currently displayed on the screen of the first device. Or, the second data can be clipboard data from the first device, etc.

[0058] The data format supported by the aforementioned foreground application can be a data format pre-acquired by the first device. For example, in some embodiments of this application, before converting the second data based on the data format supported by the foreground application to obtain the first data, and before sending the first data to the second device based on the communication connection, the method may further include: obtaining adaptation information of the foreground application of the second device. The adaptation information includes: view type and data type, wherein the view type is used to indicate the view type of the view in the foreground application that supports inserting data, and the data type is the data type of the data that can be inserted in the view indicated by the view type; the data format indicated by the data type is the data format supported by the foreground application.

[0059] The method for obtaining the adaptation information can be the same as or different from the method for obtaining the application identifier. For example, in some embodiments of this application, the adaptation information and the application identifier together constitute application information, which is obtained after establishing a communication connection with the second device.

[0060] The above-mentioned conversion of the second data based on the data format supported by the front-end application to obtain the first data may refer to: converting the second data based on the data type in the adaptation information to obtain the first data.

[0061] The aforementioned adaptation information may refer to basic drag-and-drop adaptation information. Specifically, the view type in this adaptation information can include drag-and-drop view types supported by the current foreground application, such as a chat input box (EditText) and a file list (RecyclerView). The data type in this adaptation information can include a list of acceptable MIME types, such as images (image / png) and text (text / plain).

[0062] In some embodiments of this application, the second device can obtain the unique identifier and application type of the currently running foreground application through the Android system's ActivityManager / UsageStatsManager interface. The unique identifier may include the package name and the current Activity name, and the second device can send the unique identifier and application type to the first device in real time via the BLE control channel. The package name can serve as the application identifier, and the adaptation information may include the Activity name and application type.

[0063] The aforementioned adaptation information can be used to indicate the drag-and-drop capabilities of the foreground application. These capabilities can refer to the data types that the current interface or page of the foreground application can receive. For example, when the second device's currently displayed interface is a chat window of the foreground application, the drag-and-drop capabilities may include: text data. When the second device's currently displayed interface is a photo album of the foreground application, the drag-and-drop capabilities may include: image data. When the second device's currently displayed interface is a file manager of the foreground application, the drag-and-drop capabilities may include: file data.

[0064] The Activity name mentioned above can be an interface identifier or page identifier in the foreground application. Since the drag-and-drop capabilities of different interfaces or pages in the foreground application may differ, the data types that the current interface of the foreground application can receive can be determined based on the Activity name.

[0065] In some embodiments of this application, converting the format of the second data based on the data type in the adaptation information to obtain the first data, and sending the first data to the second device based on the communication connection may include: converting the format of the second data based on the data type in the adaptation information to obtain the first data, generating a drag-and-drop operation, and sending the first data to the second device based on the communication connection, wherein the drag-and-drop operation is used to drag the first data from the first device to the second device. Specifically, during the process of transmitting the first data from the first device to the second device, the transmission process can simulate a drag-and-drop path and display drag-and-drop animation effects to facilitate users to intuitively view the position of the first data in the second device after transmission, and at the same time, it can enhance the fun of the data transmission process.

[0066] It is understood that the above-mentioned format conversion of the second data based on the data type in the adaptation information to obtain the first data can be: converting the second data into a draggable format supported by the second device according to the drag-and-drop capability of the second device, so that the drag-and-drop animation of the first data can be displayed subsequently. For example, the second data can be converted into one of the data types indicated by the data type in the adaptation information. The above-mentioned drag-and-drop operation is used to instruct the second device to display the drag-and-drop animation during the first data transmission process after receiving the first data. That is, the sending end converts the user-selected content, screen content, or clipboard content into a drag-and-drop specification format according to the drag-and-drop capability of the receiving end.

[0067] In this implementation, by acquiring second data and converting it to a format supported by the foreground application to obtain the first data, and then sending the first data to the second device via the communication connection, the second device can conveniently display drag-and-drop animations during the first data transmission process after receiving the first data. This allows users to intuitively view the position of the first data on the second device after transmission, and also enhances the fun of the data transmission process.

[0068] Optionally, the step of converting the second data to the first data based on the data format supported by the foreground application, and sending the first data to the second device based on the communication connection, includes:

[0069] The confirmation screen will be displayed.

[0070] Upon receiving confirmation from the user on the confirmation interface, the second data is converted to the first data based on the data format supported by the foreground application, and then the first data is sent to the second device based on the communication connection.

[0071] In some embodiments of this application, after displaying the confirmation interface, the method further includes:

[0072] If the user cancels the confirmation screen, the transmission of the second data is terminated and a first prompt message is output. Alternatively, if the confirmation screen displays for more than a first time period and no user action is received, the transmission of the second data is terminated and a first prompt message is output, wherein the first prompt message is used to indicate that the transmission of the second data has been canceled.

[0073] The confirmation interface described above can be a pop-up window, which may include a confirmation control and a cancellation control. The user can click the confirmation control to enter the confirmation action. Conversely, the user can also click the cancellation control to enter the cancellation action.

[0074] The value of the first duration can be set as needed, for example, it can be 3 seconds or 5 seconds. It is understood that if the confirmation interface shows that the first duration has been exceeded and no user operation has been received, it can be regarded as the user has not confirmed the timeout. At this time, it can be assumed that the user has canceled the operation. Therefore, the sending of the second data can be terminated and the first prompt message can be output.

[0075] The aforementioned first prompt message can be displayed in the form of a pop-up window. The content of the first prompt message can be set as needed, such as "This transmission operation has been cancelled" or "This transmission process has been cancelled".

[0076] In some embodiments of this application, the above-mentioned confirmation interface may also be a preview interface displayed on the first device in the form of a floating window or an atom island. The preview interface may include a content type identifier, a confirmation control, and a cancellation control.

[0077] In some embodiments of this application, after the first device establishes a communication connection with the second device, the first device can obtain the application information of the second device and adaptively process the transmitted content according to the application type.

[0078] In this embodiment, a confirmation interface is displayed; upon receiving a user's confirmation operation on the confirmation interface, the second data is converted to the first data based on the data format supported by the foreground application, and the first data is sent to the second device based on the communication connection. Thus, by adding a user confirmation operation before data transmission, data security is further improved, thereby further reducing the risk of data mistransmission or data leakage.

[0079] Optionally, the communication connection includes a BLE control channel and a Wi-Fi P2P data channel, and obtaining the application identifier of the foreground application of the second device includes:

[0080] Receive the application identifier of the foreground application of the second device sent by the second device based on the BLE control channel;

[0081] Sending the first data to the second device based on the communication connection includes:

[0082] The first data is sent to the second device based on the Wi-Fi P2P data channel.

[0083] It is understandable that the aforementioned BLE control channel and Wi-Fi P2P data channel can be a hierarchical communication connection established between the first device and the second device based on a touch event or proximity event.

[0084] The aforementioned BLE control channel can be established based on the Bluetooth Low Energy protocol, used for real-time transmission of small data such as application identifiers, drag-and-drop support capabilities, and control commands, balancing low power consumption and response speed.

[0085] The aforementioned Wi-Fi P2P data channel can establish a high-speed link based on the Wi-Fi point-to-point direct connection protocol for transmitting adapted drag-and-drop content and original file data, ensuring the efficiency of large file transmission. The drag-and-drop content includes metadata.

[0086] In this implementation, the application identifier is transmitted via a BLE control channel, thus ensuring both low-power transmission and fast response. Simultaneously, the first data is transmitted via a Wi-Fi P2P data channel, ensuring efficient large file transfers.

[0087] Optionally, the method further includes:

[0088] If the application identifier is an application identifier outside the whitelist, the transmission of the first data is terminated, and a second prompt message is output, wherein the second prompt message is used to indicate that the transmission of the first data is not supported.

[0089] The aforementioned second prompt message can be displayed in the form of a pop-up window. The content of the second prompt message can be set as needed, such as "This transmission is not supported" or "The application of the second device does not have permission to access this data".

[0090] In this embodiment of the application, a whitelist-based judgment mechanism is used to determine whether to transmit data based on whether the foreground application of the second device is in the whitelist, thereby achieving application-level security control.

[0091] In this embodiment, if the application identifier is an application identifier outside the whitelist, the transmission of the first data is terminated and a second prompt message is output. This can further prevent data leakage and improve data security.

[0092] Optionally, the touch event includes a touch event detected by the screen capacitive sensor in the first device, and the proximity event includes a proximity event detected by the screen capacitive sensor in the first device, wherein the screen capacitive sensor detects a touch event or proximity event with the second device when the second device moves closer to the first device to such that the capacitance value detected by the screen capacitive sensor changes.

[0093] The screen capacitive sensor can be a capacitive sensor in the screen of the first device. Specifically, an existing capacitive sensor in the screen can be reused to detect the touch event.

[0094] In this embodiment, touch events or proximity events are detected based on a screen capacitive sensor. Thus, when the second device approaches the first device, the capacitance value detected by the screen capacitive sensor will change, thereby enabling the detection process of touch events or proximity events.

[0095] Please see Figure 2 , Figure 2 This is a flowchart illustrating a data transmission method provided in an embodiment of this application. The data transmission method is applied to a second device and includes the following steps:

[0096] Step 201: Upon detecting a touch event or proximity event with the first device, establish a communication connection with the first device;

[0097] Step 202: Send the application identifier of the foreground application to the first device;

[0098] Step 203: Receive the first data sent by the first device.

[0099] The touch or proximity event between the first device and the second device can be detected by a relevant near-field device in the first device, or by a relevant near-field device in the second device, or simultaneously by relevant near-field devices in both devices. It is understood that upon detecting a touch or proximity event with the first device, a communication connection can be established between the two. The near-field device can be a device in the second device whose signal changes when another device approaches; for example, it can be various capacitive sensors.

[0100] This implementation method is a data transmission method on the second device side corresponding to the above embodiments. Its implementation process corresponds to the above embodiments and has the same beneficial effects. To avoid repetition, it will not be described again here.

[0101] Optionally, receiving the first data sent by the first device includes:

[0102] Receive the first data sent by the first device;

[0103] If the first data matches the data format supported by the front-end application, the first data is displayed at the target location on the front-end application interface.

[0104] The first data mentioned above matching the data format supported by the front-end application can mean that the first data matches the adaptation information of the front-end application, wherein the adaptation information includes: view type and data type, the view type being used to indicate the view type of the view in the front-end application that supports inserting data, and the data type being the data type of the data that can be inserted in the view indicated by the view type.

[0105] Matching the first data with the adaptation information of the foreground application may include: the foreground application including the view indicated by the view type, and the data type in the adaptation information including the data type of the first data. In some embodiments of this application, matching the first data with the adaptation information of the foreground application may also mean: the first data matching the drag-and-drop capability of the foreground application. Here, the drag-and-drop capability of the foreground application may refer to the data types that the current interface or page of the foreground application can receive. For example, when the interface currently displayed on the second device is a chat box of the foreground application, the drag-and-drop capability of the foreground application may include: text data. When the interface currently displayed on the second device is a photo album of the foreground application, the drag-and-drop capability of the foreground application may include: image data. When the interface currently displayed on the second device is a file manager of the foreground application, the drag-and-drop capability of the foreground application may include: file data.

[0106] Accordingly, the matching of the first data with the drag-and-drop capability of the foreground application can mean that the data type of the first data is a data type supported by the drag-and-drop capability of the foreground application. For example, when the interface currently displayed on the second device is the photo album of the foreground application, if the first data is image data, then the first data matches the drag-and-drop capability of the foreground application. Conversely, when the interface currently displayed on the second device is the photo album of the foreground application, if the first data is a Word file, then the first data does not match the drag-and-drop capability of the foreground application.

[0107] The views indicated by the view type in the aforementioned front-end application may include: views related to data input, such as cursors and input boxes.

[0108] The target location mentioned above can be the location of a view that supports data insertion within the currently displayed interface of the foreground application. For example, if an input box exists in the currently displayed interface of the foreground application, the target location can be the location of the input box. Or, if an editable file is open in the currently displayed interface of the foreground application, the target location can be the location of the open editable file. Alternatively, the target location can be the current focus position of the foreground application, which can be the current editing position of the foreground application on the second device, such as the cursor position or other type of operation focus position in the foreground application. Alternatively, the target location can also be the area for adding attachments, etc.

[0109] After receiving the first data and the drag operation, the second device can obtain the insertion focus of the foreground application on the device, simulate the drag path, display the drag animation, and insert the first data into the corresponding focus.

[0110] In some embodiments of this application, the second device can inject the first data into the current foreground application through a drag-and-drop mechanism, automatically identify the interactive nodes of the foreground application, such as chat boxes or editing areas, and directly inject the data content of the first data into the focus position to achieve precise insertion of content.

[0111] In this embodiment, by displaying the first data at the target position on the front-end application interface when the first data matches the data format supported by the front-end application, the data content of the first data can be directly injected into the target position, achieving precise insertion of content.

[0112] Optionally, receiving the first data sent by the first device includes:

[0113] Receive the first data sent by the first device;

[0114] If the first data does not match the data format supported by the front-end application or the front-end application interface does not include the target object, the first data is stored.

[0115] The aforementioned front-end application interface can refer to the currently displayed interface of the front-end application.

[0116] The aforementioned mismatch between the first data and the data format supported by the foreground application can mean that the data type in the adaptation information does not include the data type of the first data. The foreground application interface does not include the target object: the foreground application does not include the view object indicated by the view type. In some embodiments of this application, the target object may include view objects related to data input, such as a cursor, user focus, and an add attachment icon. That is, if the foreground application interface does not include a cursor, does not have user focus, and does not have an add attachment icon, it is determined that the foreground application interface does not include the target object. It should be noted that the aforementioned target object may include a cursor, user focus, and an add attachment icon, which is only one example of this application. In fact, the foreground application interface not including the target object can mean that the foreground application interface does not include any view object into which the first data can be inserted, i.e., the first data cannot be inserted into the current display interface of the foreground application.

[0117] In cases where the first data does not match the data format supported by the foreground application, or the foreground application interface does not include the target object, it can be determined that the first data does not match the drag-and-drop capability of the foreground application. That is, the current display interface of the foreground application does not support dragging the first data. In this case, it automatically degrades to "save to local". The storage location of the first data can be the system default location or a user-defined location, or it can be the data storage location corresponding to the foreground application, which can be set as needed.

[0118] In this embodiment, the first data is stored even if the first data does not match the data format supported by the foreground application or the foreground application interface does not include the target object. In this way, even if the foreground application does not support dragging and dropping the first data, the first data can still be transmitted to the second device to ensure that the data transmission process proceeds normally.

[0119] Please see Figure 3 , Figure 3 This is a flowchart illustrating a data transmission method provided in an embodiment of this application. The data transmission method includes the following steps:

[0120] Step 301: The two devices establish a hierarchical communication connection based on screen touch events.

[0121] When the screens of the first device and the second device physically touch or hover at close range (≤5mm), the touch event is detected by the screen's capacitive sensor, triggering a dual-channel collaborative communication connection for a touch-to-touch connection.

[0122] Dual-channel functional division:

[0123] BLE control channel: Established based on Bluetooth Low Energy protocol, it transmits small data such as application identifiers, drag-and-drop support capabilities, and control commands in real time, balancing low power consumption and response speed.

[0124] Wi-Fi P2P data channel: A high-speed link is established based on the Wi-Fi point-to-point direct connection protocol to transmit adapted drag-and-drop content (including metadata) and original file data, ensuring the efficiency of large file transfer;

[0125] Interactive capability prior synchronization: After the dual connection is established, the second device synchronizes drag-and-drop adaptation basic information to the first device through the BLE control channel, including the drag-and-drop view types supported by the current foreground application and the list of acceptable MIME types.

[0126] Step 302: The first device obtains the front-end application information of the second device and completes the whitelist verification.

[0127] Application information real-time reporting: The second device obtains the unique identifier (package name, current Activity name) and application type of the currently running application through the Android system ActivityManager / UsageStatsManager interface, and sends it to the first device in real time through the BLE control channel. The unique identifier includes the package name and the current Activity name.

[0128] Whitelist permission verification: The first device matches the received application package name with the local preset whitelist. Only if the application belongs to the whitelist will the subsequent content distribution process be triggered; if the verification fails, the first device will terminate the subsequent transmission process.

[0129] Step 303: First device startup content preview and user confirmation.

[0130] Automatic content recognition: The first device captures the set of target content that can be sent at present;

[0131] Preview interface display: The preview interface is displayed on the first device in the form of a floating window or an atom island, including a content type identifier; a confirm button; and a cancel operation button;

[0132] Step 304: User confirms operation response.

[0133] Click "Confirm": This will trigger the subsequent transmission and insertion process.

[0134] Click Cancel: This will terminate the process and clear temporary cache content.

[0135] If no action is taken after the countdown expires: The preview interface will automatically close and the transmission will be terminated to prevent accidental sending.

[0136] Step 305: The first device adapts to drag-and-drop capabilities and transmits content in layers.

[0137] Content format adaptation: The first device converts the user-confirmed target content into a drag-and-drop and transmittable format based on the drag-and-drop support capability of the second device.

[0138] Step 306: The second device completes precise injection by relying on the drag-and-drop frame.

[0139] After receiving the command, the second device obtains the insertion focus of the application on the device, simulates the drag path, displays the drag animation, and inserts the content into the corresponding focus.

[0140] Step 307, Exception Handling.

[0141] Whitelist verification failed: The first device displayed a "Not supported" message and terminated the transmission.

[0142] Preview timeout / cancellation: Prompt to cancel;

[0143] Drag and drop capability mismatch: Automatically downgrade to "Save to local".

[0144] The data transmission method provided in this application embodiment accurately controls transmission permissions through a whitelist verification mechanism for the front-end application, effectively avoiding the risk of accidentally sending sensitive content. At the same time, relying on a closed-source drag-and-drop framework, the content is directly injected into the interactive nodes of the front-end application of the receiving end, such as chat boxes and editing areas, skipping the redundant process of "storage-manual insertion".

[0145] Please see Figure 4 , Figure 4 for Figure 3 The diagram shown illustrates the general process of drag-and-drop injection corresponding to the data transmission method. Figure 4 The APP in the context refers to the foreground application on the second device, also known as the target application. The Framework refers to the framework of the APP, and the peer device is the first device. The drag-and-drop injection process generally includes the following steps:

[0146] Step 1: The APP is in the corresponding scenario, specifically, the APP is in a scenario where it needs to insert relevant data from the other end device.

[0147] Step 2: The APP registers with the Framework to listen for drag state.

[0148] Step 3: The APP sends stateDrag(clipDate, label filled with Vpctophone) to the Framework. During the drag process, the system creates a DragState, in which the label of the ClipData is set to "Vpctophone".

[0149] Step 4: Framework identifies labels.

[0150] Step 5: During the simulated drag and drop process: The Framework returns the onDrag result of the target application to the APP.

[0151] Step 6: If at least one of the following occurs, the Framework will intercept this Drag: the communication connection between the first device and the second device is broken; the application identifier of the foreground application in the second device is an application identifier outside the whitelist; the user cancels the operation on the confirmation screen; the confirmation screen has been displayed for more than the first time period and no operation from the user has been received.

[0152] Step 7: If the situation in step 6 does not occur, the Framework sends a DragState notification to the App after the simulated drag and drop.

[0153] Step 8: The APP requests to download the file from the other device, that is, requests to download the first data.

[0154] Step 9: The peer device sends a file to the APP, that is, the peer device sends the first data to the APP.

[0155] Step 10: The APP attempts to inject a real file into the target application, wherein the real file is the first data.

[0156] exist Figure 4 In the embodiment shown, the sending end converts the user's pre-selected content, screen content, or clipboard content into a drag-and-drop format based on the receiving end's drag-and-drop capability, and transmits the content and instructions through different channels; the receiving end automatically locates the foreground application interaction node or focus, and uses a closed-source drag-and-drop framework to accurately insert the content into the focus position.

[0157] Please see Figure 5 , Figure 5 for Figure 3 The diagram shown illustrates the overall timing flow of the data transmission method. Figure 5 The sending end is the first device, and the receiving end is the second device. The overall timing flow corresponding to the data transmission method includes the following steps:

[0158] Step 1: The two devices establish a hierarchical communication connection based on screen touch events.

[0159] Step 2: Support for synchronous drag-and-drop from the receiving end to the sending end.

[0160] Step 3: The receiving end reports the foreground application information to the sending end.

[0161] Step 4: The sending end performs whitelist permission verification.

[0162] Step 5: If the whitelist verification fails, a pop-up window will display "[Not supported]" and the transmission will be terminated.

[0163] Step 6: If the whitelist verification passes, capture the second data and preview it.

[0164] Step 7: When the user clicks [Cancel] or the operation times out, the sending end displays [Canceled], clears the cache, and terminates the transmission.

[0165] Step 8: When the user clicks [Confirm], the sending end converts the content format according to the drag-and-drop capability to adapt to the types supported by the receiving end.

[0166] Step 9: Layered transmission at the sending end: Wi-Fi P2P data channel transmits content, BLE control channel transmits injection commands.

[0167] Step 10: The receiving end determines whether it supports the drag-and-drop capability of the content.

[0168] Step 11: If the drag-and-drop capability is incompatible, it will automatically downgrade to keeping the content locally and prompt a message.

[0169] Step 12: If the drag-and-drop capability matches, then locate the application and insert focus to simulate the drag-and-drop path and display dynamic effects.

[0170] Step 13: The receiving end inserts the content into the corresponding focus position.

[0171] Step 14: The receiving end sends a successful injection feedback to the sending end.

[0172] The data transmission method provided in this application can be executed by a data transmission device. This application uses a data transmission device executing the data transmission method as an example to illustrate the data transmission device provided in this application.

[0173] Please see Figure 6 , Figure 6 This is a schematic diagram of a data transmission device 600 provided in an embodiment of this application. The data transmission device 600 is applied to a first device, and the device includes:

[0174] The first connection module 601 is used to establish a communication connection with the second device when a touch event or proximity event with the second device is detected.

[0175] The acquisition module 602 is used to acquire the application identifier of the foreground application of the second device;

[0176] The first sending module 603 is used to send first data to the second device based on the communication connection when the application identifier is an application identifier in the whitelist stored in the first device.

[0177] Optionally, the first transmitting module 603 includes:

[0178] The `get` submodule is used to retrieve the second data.

[0179] The sending submodule is used to convert the second data according to the data format supported by the foreground application to obtain the first data, and send the first data to the second device based on the communication connection.

[0180] Optionally, the sending submodule includes:

[0181] The display unit is used to display the confirmation interface;

[0182] The sending unit is configured to, upon receiving a confirmation operation from the user in the confirmation interface, convert the second data according to the data format supported by the foreground application to obtain the first data, and send the first data to the second device based on the communication connection.

[0183] Optionally, the communication connection includes a BLE control channel and a Wi-Fi P2P data channel;

[0184] The acquisition module is used to receive the application identifier of the foreground application of the second device sent by the second device based on the BLE control channel;

[0185] The first sending module is used to send first data to the second device based on the Wi-Fi P2P data channel.

[0186] In this implementation, when a user needs to transfer data from the first device to the second device, a communication connection between the two devices can be established simply by triggering a touch or proximity event between them. Then, the application identifier of the foreground application on the second device is obtained, and a whitelist verification is performed based on the application identifier. If the verification passes, data can be directly transmitted to the second device based on the established communication connection. This simplifies the data transmission process between different devices. Furthermore, by performing whitelist verification before data transmission, transmission permissions can be precisely controlled, effectively mitigating the risk of accidentally sending sensitive content.

[0187] It should be noted that the data transmission device 600 in the embodiments of this application can be the first device or a component of the first device, such as an integrated circuit or a chip.

[0188] The data transmission device 600 in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0189] The data transmission device 600 in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit its use.

[0190] The data transmission device 600 provided in this application embodiment can achieve... Figure 1 The various processes implemented in the method embodiments achieve the same technical effect, and will not be described again here to avoid repetition.

[0191] Please see Figure 7 , Figure 7 This is a schematic diagram of a data transmission device 700 provided in an embodiment of this application. The data transmission device 700 is applied to a second device, and the device includes:

[0192] The second connection module 701 is used to establish a communication connection with the first device when a touch event or proximity event with the first device is detected.

[0193] The second sending module 702 is used to send the application identifier of the foreground application to the first device;

[0194] The receiving module 703 is used to receive the first data sent by the first device.

[0195] Optionally, the receiving module 703 includes:

[0196] A receiving submodule is used to receive the first data sent by the first device;

[0197] The display submodule is used to display the first data at a target position on the front-end application interface when the first data matches the data format supported by the front-end application.

[0198] Optionally, the receiving module 703 includes:

[0199] A receiving submodule is used to receive the first data sent by the first device;

[0200] The storage submodule is used to store the first data when the first data does not match the data format supported by the front-end application or when the front-end application interface does not include the target object.

[0201] In this implementation, when a user needs to transfer data from the first device to the second device, a communication connection between the two devices can be established simply by triggering a touch or proximity event between them. Then, the application identifier of the foreground application on the second device is obtained, and a whitelist verification is performed based on the application identifier. If the verification passes, data can be directly transmitted to the second device based on the established communication connection. This simplifies the data transmission process between different devices. Furthermore, by performing whitelist verification before data transmission, transmission permissions can be precisely controlled, effectively mitigating the risk of accidentally sending sensitive content.

[0202] It should be noted that the data transmission device 700 in the embodiments of this application can be a second device or a component of a second device, such as an integrated circuit or a chip.

[0203] The data transmission device 700 in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0204] The data transmission device 700 in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit its use.

[0205] The data transmission device 700 provided in this application embodiment can achieve... Figure 2 The various processes implemented in the method embodiments achieve the same technical effect, and will not be described again here to avoid repetition.

[0206] In some embodiments, such as Figure 8 As shown, this application embodiment also provides an electronic device 800, including a processor 801, a memory 802, and a program or instructions stored in the memory 802 and executable on the processor 801. When the program or instructions are executed by the processor 801, they implement the various processes of the above-described data transmission method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0207] Figure 9 A schematic diagram of the hardware structure of an electronic device according to an embodiment of this application.

[0208] The electronic device 900 includes, but is not limited to, components such as: radio frequency unit 901, network module 902, audio output unit 903, input unit 904, sensor 905, display unit 906, user input unit 907, interface unit 908, memory 909, and processor 910.

[0209] The radio frequency unit 901 is used to establish a communication connection with the second device when a touch event or proximity event with the second device is detected.

[0210] The radio frequency unit 901 is used to obtain the application identifier of the foreground application of the second device;

[0211] The radio frequency unit 901 is used to send first data to the second device based on the communication connection when the application identifier is an application identifier in the whitelist stored in the first device.

[0212] Optionally, the radio frequency unit 901 is used to acquire second data;

[0213] The processor 910 is configured to convert the second data according to the data format supported by the foreground application to obtain the first data, and send the first data to the second device based on the communication connection.

[0214] Optionally, the display unit 906 is used to display a confirmation interface;

[0215] The processor 910 is configured to, upon receiving a confirmation operation from the user in the confirmation interface, convert the second data according to the data format supported by the foreground application to obtain the first data, and send the first data to the second device based on the communication connection.

[0216] Optionally, the communication connection includes a BLE control channel and a Wi-Fi P2P data channel, and the radio frequency unit 901 is used to receive the application identifier of the foreground application of the second device sent by the second device based on the BLE control channel;

[0217] The radio frequency unit 901 is used to send first data to the second device based on the Wi-Fi P2P data channel.

[0218] In some embodiments of this application, the radio frequency unit 901 is used to establish a communication connection with the first device when a touch event or proximity event with the first device is detected;

[0219] The radio frequency unit 901 is used to send the application identifier of the foreground application to the first device.

[0220] The radio frequency unit 901 is used to receive the first data sent by the first device.

[0221] Optionally, the radio frequency unit 901 is used to receive the first data sent by the first device;

[0222] The processor 910 is configured to display the first data at a target location on the front-end application interface when the first data matches the data format supported by the front-end application.

[0223] Optionally, the radio frequency unit 901 is used to receive the first data sent by the first device;

[0224] The memory 909 is used to store the first data when the first data does not match the data format supported by the foreground application or when the foreground application interface does not include the target object.

[0225] Those skilled in the art will understand that the electronic device 900 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 910 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 9 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0226] It should be understood that, in this embodiment, the input unit 904 may include a graphics processing unit (GPU) 9041 and a microphone 9042. The GPU 9041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 906 may include a display panel 9061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 907 includes a touch panel 9071 and other input devices 9072. The touch panel 9071 is also called a touch screen. The touch panel 9071 may include a touch detection device and a touch controller. Other input devices 9072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.

[0227] The memory 909 can be used to store software programs and various data. The memory 909 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 909 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 909 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0228] Processor 910 may include one or more processing units; optionally, processor 910 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 910.

[0229] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described data transmission method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0230] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0231] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above data transmission method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0232] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0233] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0234] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0235] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A data transmission method, applied to a first device, characterized in that, The method includes: Upon detecting a touch event or proximity event with the second device, a communication connection with the second device is established; Obtain the application identifier of the foreground application of the second device; If the application identifier is an application identifier in the whitelist stored in the first device, the first data is sent to the second device based on the communication connection.

2. The method according to claim 1, characterized in that, Sending the first data to the second device based on the communication connection includes: Obtain the second data; The second data is converted to the first data based on the data format supported by the foreground application, and then the first data is sent to the second device based on the communication connection.

3. The method according to claim 2, characterized in that, The step of converting the second data to a format based on the data format supported by the foreground application to obtain the first data, and sending the first data to the second device based on the communication connection, includes: The confirmation screen will be displayed. Upon receiving confirmation from the user on the confirmation interface, the second data is converted to the first data based on the data format supported by the foreground application, and then the first data is sent to the second device based on the communication connection.

4. The method according to any one of claims 1 to 3, characterized in that, The communication connection includes a BLE control channel and a Wi-Fi P2P data channel. Obtaining the application identifier of the foreground application of the second device includes: Receive the application identifier of the foreground application of the second device sent by the second device based on the BLE control channel; Sending the first data to the second device based on the communication connection includes: The first data is sent to the second device based on the Wi-Fi P2P data channel.

5. A data transmission method applied to a second device, characterized in that, The method includes: Upon detecting a touch event or proximity event with the first device, establish a communication connection with the first device; Send the application identifier of the foreground application to the first device; Receive the first data sent by the first device.

6. The method according to claim 5, characterized in that, The receiving of the first data sent by the first device includes: Receive the first data sent by the first device; If the first data matches the data format supported by the front-end application, the first data is displayed at the target location on the front-end application interface.

7. The method according to claim 5, characterized in that, The receiving of the first data sent by the first device includes: Receive the first data sent by the first device; If the first data does not match the data format supported by the front-end application or the front-end application interface does not include the target object, the first data is stored.

8. A data transmission device, applied to a first device, characterized in that, The device includes: The first connection module is used to establish a communication connection with the second device when a touch event or proximity event with the second device is detected. The acquisition module is used to acquire the application identifier of the foreground application of the second device; The first sending module is configured to send first data to the second device based on the communication connection when the application identifier is an application identifier in the whitelist stored in the first device.

9. The apparatus according to claim 8, characterized in that, The first sending module includes: The `get` submodule is used to retrieve the second data. The sending submodule is used to convert the second data according to the data format supported by the foreground application to obtain the first data, and send the first data to the second device based on the communication connection.

10. The apparatus according to claim 9, characterized in that, The sending submodule includes: The display unit is used to display the confirmation interface; The sending unit is configured to, upon receiving a confirmation operation from the user in the confirmation interface, convert the second data according to the data format supported by the foreground application to obtain the first data, and send the first data to the second device based on the communication connection.

11. The apparatus according to any one of claims 8 to 10, characterized in that, The communication connection includes a BLE control channel and a Wi-Fi P2P data channel; The acquisition module is used to receive the application identifier of the foreground application of the second device sent by the second device based on the BLE control channel; The first sending module is used to send first data to the second device based on the Wi-Fi P2P data channel.

12. A data transmission device, applied to a second device, characterized in that, The device includes: The second connection module is used to establish a communication connection with the first device when a touch event or proximity event with the first device is detected. The second sending module is used to send the application identifier of the foreground application to the first device; The receiving module is used to receive the first data sent by the first device.

13. The apparatus according to claim 12, characterized in that, The receiving module includes: A receiving submodule is used to receive the first data sent by the first device; The display submodule is used to display the first data at a target position on the front-end application interface when the first data matches the data format supported by the front-end application.

14. The apparatus according to claim 13, characterized in that, The receiving module includes: A receiving submodule is used to receive the first data sent by the first device; The storage submodule is used to store the first data when the first data does not match the data format supported by the front-end application or when the front-end application interface does not include the target object.

15. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and the program or instructions, when executed by the processor, implement the steps of the data transmission method as described in any one of claims 1-7.

16. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the data transmission method as described in any one of claims 1-7.