Search code examples
androidandroid-wifi

How the "SHAREit" android application works technically?


I want to build a data sharing application on android using wi-fi like "SHAREit" but I did not get where I start from.

So if any clear me the technical concept of "SHAREit" it was very much efficient to understand.

  1. When we want to send a file we saw the available receiver device with name.
    • Is the name displayed as SSID or other?
    • How we broadcast name and other info to display on sender device?
  2. When I select a device to send a file then what happens?
  3. What API actually I can use to and what for please explain me simply.

Please all resources and links that I could run to test.


Solution

  • Use the Android Wi-Fi P2P libaries, and start with the doc on this page. It tells you how use Wi-Fi P2P for service discovery, which takes care of item 1 in your requirements. Basically, you have each device transmit a DNS-SD TXT that can contain user ID info, etc. Devices can see its contents without having to establish a socket, which is what you will later do to accomplish item 2 in your requirements.