File sharing method based on Android system
The file sharing method implemented by using dnssd service and Socket connection in the Android system solves the problem of cumbersome and inefficient file transfer in the TV store, and realizes automated and easy-to-use file transfer, improving transmission efficiency and reducing training needs.
Patent Information
- Application Number
- CN202411701666.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-25
AI Technical Summary
The existing file transfer methods appear cumbersome and inefficient in TV store applications, especially the lack of understanding of the use of various software by shopping guides, which leads to complex transmission process.
The file sharing method based on the Android system is adopted, and the device is automatically discovered using the dnssd service and file transfer is carried out through Socket connection, simplifying the operation process.
It realizes the automation and ease of use of file transfer between TVs, improves transmission efficiency, reduces the training needs for shopping guides, and supports the flexible use of TVs.
Smart Images

Figure CN119520508A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file transmission, and in particular to a file sharing method based on an Android system. Background Art
[0002] Existing file transfer methods can be transmitted through USB flash drives, Bluetooth or the Internet. When used, it is generally necessary to manually open the application or manually plug and unplug the USB flash drive and then copy through the application. In TV store applications, due to the large number of TVs in the store and the lack of understanding of the use of various software by shopping guides, the existing file transfer methods are relatively cumbersome and have low transmission efficiency. Summary of the invention
[0003] In order to simplify the operation of file transfer between TVs by TV store guides and improve the usability of file transfer, this application provides a file sharing method based on the Android system.
[0004] The technical solution adopted by the present invention to solve the above problems is:
[0005] The file sharing method based on the Android system includes:
[0006] Step 1: Start the dnssd service and serverSocket to wait for connection when the device is connected to the Internet; the dnssd service has the device information and file transfer identifier registered;
[0007] Step 2: Determine the devices available for file transfer in the local area network based on the file transfer identifier, save the discovered devices as a device list and parse the information of each device;
[0008] Step 3: Determine the sender and receiver based on the devices in the device list, and establish a connection between the sender and receiver based on the Socket;
[0009] Step 4: The sender selects the file to be transmitted and sends it to the receiver. The receiver receives the file in the background until the file to be transmitted is completely transmitted.
[0010] Furthermore, the step 4 is specifically as follows:
[0011] The sender selects the file to be transferred, identifies the MD5 code and file path of the file to be transferred, saves it as a file list, and transmits the file list to the receiver based on the Socket connection;
[0012] After receiving the file list, the receiving end determines whether the files under the corresponding path exist in turn. If they exist, they are not processed; if they do not exist, a transmission start mark is returned to the sending end with the MD5 code of the required file.
[0013] After receiving the identifier for starting transmission, the sending end starts file transmission according to the MD5 code of the required file.
[0014] Furthermore, the device information includes: device name and device IP address.
[0015] Compared with the prior art, the present invention has the following beneficial effects: automatic discovery of transmission devices and receiving devices is realized based on the DNSSD service, and file transmission is performed based on the Socket connection, which simplifies the operation of file transmission between TVs by shopping guides in TV stores, improves the usability of file transmission, and is conducive to the use of TVs in scenes such as stores and exhibitions; avoids repeated and tedious training of relevant shopping guides and personnel with such needs, and reduces the use of manpower; transmission in the background is conducive to the flexible use of TVs, and the receiving end does not affect the normal use of TVs when receiving files. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flowchart of the file sharing method for the Android system;
[0017] Figure 2 The flowchart for file transfer is shown in FIG. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0019] like Figure 1 As shown, the file sharing method based on the Android system includes:
[0020] Step 1: Start the dnssd service and serverSocket to wait for connection when the device is connected to the Internet; the dnssd service has the device information and file transfer identifier registered; the device information includes the device name and the device IP address;
[0021] Step 2: Determine the devices available for file transfer in the local area network based on the file transfer identifier, save the discovered devices as a device list and parse the information of each device;
[0022] Step 3: Determine the sender and receiver based on the devices in the device list, and establish a connection between the sender and receiver based on the Socket;
[0023] Step 4: The sender selects the file to be transferred and sends it to the receiver. The receiver receives the file in the background until the file to be transferred is completed. Specifically, the sender selects the file to be transferred, identifies the MD5 code and file path of the file to be transferred, and saves it as a file list. The file list is transmitted to the receiver based on the Socket connection. After receiving the file list, the receiver determines whether the file under the corresponding path exists. If it exists, it will not be processed. If it does not exist, it returns a start transfer identifier to the sender with the MD5 code of the required file. After receiving the start transfer identifier, the sender starts file transfer according to the MD5 code of the required file.
[0024] Taking Android TV as an example, the file sharing method based on the Android system includes:
[0025] Step 1: Prepare several Android TVs, and all of these TVs are pre-installed with the monitoring broadcast service that starts up.
[0026] Step 2: Turn on these TVs.
[0027] Step 3: Connect these TVs to the same local area network.
[0028] Step 4: Select a TV as the transmitter, open the transmission application, and enter the application layer.
[0029] Step 5: On the sender side, select the file to be transferred in the application.
[0030] Step 6: Click the Start Searching for Devices button in the app.
[0031] Step 7: Start searching for devices registered and published by DNSSD in the LAN, and display the device names on the sender application interface.
[0032] Step 8: Based on step 7, select the name of the receiving device to be transmitted.
[0033] Step 9: Click the Start Transfer button.
[0034] Step 10: The sending application hides in the background and pops up a toast prompt, indicating that the machine is transmitting.
[0035] Step 11: A toast prompt will pop up on each receiving end, indicating that the machine is receiving.
[0036] Step 12: After the receiving end completes the reception, a toast prompt pops up, indicating that the reception is complete.
[0037] Step 13: After the sender waits for all receivers to complete the transmission, a toast prompt pops up, indicating that all devices have completed the transmission.
[0038] You can also establish a connection with the receiving device first and then select the files you want to transfer.
[0039] When transferring files, Figure 2 As shown, the sender first transmits the list of files to be transmitted and the corresponding MD5 codes to the receiver. The receiver takes the files in the list and the corresponding MD5 codes in turn. If the MD5 code does not exist, the MD5 code of the file is sent to the sender. The sender performs file transmission according to the received MD5 code. If the MD5 code exists, it means that the file already exists and will not be transmitted again. When all the files in the list of files to be transmitted are judged to have been transmitted, the transmission ends.
[0040] Transmission is based on MD5 codes. If the network environment changes in the middle of the transmission, the current transmission will be interrupted, and there will be some abnormal files that have not been transferred. Although the file name of the abnormal file is the same as the original file, its MD5 code will be different. After the network is interrupted or changed, the next time the network environment is normal, dnssd and socket will be published and opened again. When transferring files, the previous abnormal files will be overwritten.
Claims
1. A file sharing method based on Android system, characterized in that: include: Step 1. Start the dnssd service and serverSocket to wait for connection when the device is connected to the Internet. The DNSSD service has device information and file transfer identifiers registered; Step 2: Determine the devices available for file transfer in the local area network based on the file transfer identifier, save the discovered devices as a device list and parse the information of each device; Step 3: Determine the sender and receiver based on the devices in the device list, and establish a connection between the sender and receiver based on the Socket; Step 4: The sender selects the file to be transmitted and sends it to the receiver. The receiver receives the file in the background until the file to be transmitted is completely transmitted.
2. The file sharing method based on Android system according to claim 1, characterized in that: The step 4 is specifically as follows: The sender selects the file to be transferred, identifies the MD5 code and file path of the file to be transferred, saves it as a file list, and transmits the file list to the receiver based on the Socket connection; After receiving the file list, the receiving end determines whether the files under the corresponding path exist in turn. If they exist, they are not processed; if they do not exist, a transmission start mark is returned to the sending end with the MD5 code of the required file. After receiving the identifier for starting transmission, the sending end starts file transmission according to the MD5 code of the required file.
3. The file sharing method based on Android system according to claim 1, characterized in that: The device information includes: device name and device IP address.