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.
Please all resources and links that I could run to test.
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.
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.
SHAREit - Connect & Transfer is an app to transfer files from one device to another much faster than via Bluetooth or regular WiFi.
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.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With