How To Create An App Like Shareit
2 Answers 2
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).
-
answered Jan 10 '17 at 9:17
CodeFuryCodeFury
1,520 16 silver badges 29 bronze badges
1
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.
answered Jan 11 '15 at 7:46
JASON G PETERSONJASON G PETERSON
2,157 1 gold badge 15 silver badges 17 bronze badges
4
-
Can you give a source code that there device transmit some custom information beside its SSID,BSSID etc and another device can view those information before peer.
Jan 11 '15 at 13:02
-
They give you that in the example. You can put any strings you like in the Map object. The following link tell you move about the DNS SD TXT record format, but the main thing to be aware of is that you're not meant to send many bytes -- ideally 100 or less (zeroconf.org/rendezvous/txtrecords.html).
Jan 11 '15 at 14:24
-
@JASONGPETERSON Are you sure? does SHAREit uses Wi-Fi P2P? then what's the point of creating hotspot at the receiver side? and Wi-FI P2P works on and above 4.0 but SHAREit works in same concept even on Android 2.2. If you know that answer please tell me. I'm also on my way to creating file transferring app
Mar 23 '16 at 12:07
-
Slightly off-topic, but is there anything similar to Wi-Fi P2P in android SDK that can be used with multi-client setup? (For example, a local chat app that can be used between peers in the local Wi-Fi Range)
Oct 7 '16 at 7:07
Not the answer you're looking for? Browse other questions tagged android android-wifi or ask your own question.
How To Create An App Like Shareit
Source: https://stackoverflow.com/questions/27884334/how-the-shareit-android-application-works-technically
Posted by: hernandezmucall.blogspot.com
Thank you very much such wonder full app.... can you please update your answer..it's not working from Android Version O...i resolved some error 7.0 and 7.1 it's working...but O it's not working
Jun 6 '18 at 13:58