Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 695
Rashed Shaon Avatar asked Jan 11 '15 05:01

Rashed Shaon


People also ask

How does SHAREit work on Android?

SHAREit actually utilizes a wi-fi technology called SoftAP that helps to create a personal network, through inbuilt Wi-Fi radio in every mobile device, to which other devices can attach and send (or receive) files.

How does the SHAREit app work?

ShareIt allows users to send anything from a Word document or PDF to an image or video in a matter of seconds. Microsoft Launcher (free; Android) has a feature called Continue to PC feature which allows users to access content on a smartphone such as photos, document or webpages on their Windows PC.

Is SHAREit an application software?

SHAREit - Connect & Transfer is an app to transfer files from one device to another much faster than via Bluetooth or regular WiFi.

What type of app is SHAREit?

SHAREit for Android lets you transfer all kinds of files to different platforms, and it does so with impressive speed. It is a file-sharing application that allows you to send music, videos, images and much more to your friends and your other devices.


2 Answers

I've made an attempt to write a library called SHAREthem to simulate how SHAREit works. Library facilitates P2P file sharing and transfers between devices using WiFi Hotspot. It also supports app to web sharing if receiver has no app installed. Hope it helps to you understand technicals involved in file sharing using WiFi Hotspot.

Since there are many moving parts to this library, i made a blog with implementation details. Will try to cover a few components here:

  • HotspotController

    HC uses Java Reflection since there are NO APIs available on Android for enabling/disabling Hotspots. Functionalities include:

    • Controller creates an OPEN Wifi hotspot configuration with an SSID which can intercepted by Receivers to recognize SHAREthem senders including port and sender names.

    • Restores user Hotspot-Configuration when Share mode is disabled

    • Provides a list of connected WiFi clients.

  • SHAREthem Server

    A tiny HTTP server extended from NanoHttpd, serves the sender data to receivers using IP address as hostname and works on port assigned by user or system by default.

  • SHAREthem Service

    Android service which manages lifecycle of SHAREthem-server and also handles foreground notification with stop action.

  • UI (Activities)

    Android activities to handle share/receive actions

    • Receiver - provides UI to list the files available to download. Posts a download request to Android Download Manager to start file downloads.

    • Sender - displays IP, Port & connected clients info along with file transfer status for each connected client(Receiver).

    Receiver Listing fragment displaying all downloads from Sender Share Activity displaying clients info and transfers status Web Receiver

like image 85
CodeFury Avatar answered Oct 08 '22 15:10

CodeFury


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.

like image 5
JASON G PETERSON Avatar answered Oct 08 '22 14:10

JASON G PETERSON