wifi hotspot file transfer android source code. Have you ever tried to transfer data between two or more devices? Usually, we use clouds and other ways to transfer data, which require the internet. In android version 4.0, there was a feature that was supposed to change the world. It was called Wi-Fi Direct. Unfortunately, this did not happen, as the algorithm was too hard and it wasn’t user friendly enough. I decided to change the situation by using P2P technology. There are many messengers in Google Play or GitHub.
At the moment, all the apps in Google Play that help you transfer files either only function inside your local network by FTP or you would have to create a hotspot, e.g. SHAREit, or use a P2P protocol. But normally something unexpected happens.
I had the following tasks:
- Show me a list of nearby devices.
- Manage connecting, disconnecting, and reconnecting devices.
- Send messages between devices that are connected to you in order to verify it (unavailable in the official API Android).
- Share multiple files to both connected devices.
- Being able to visualize what are you sending and receiving and being able to open the received files without disconnecting
- Automatic restart of the server that is responsible for receiving files and device information
I will add my code (FileActivity) with comments, and there you will be able to see the specific methods that I use hence sending and receiving files and all other functions as well as a design working as one Activity. That’s a compelled action as the main goal is to send and receive files at the same time without a repeated initialization WifiP2PManager etc.wifi hotspot file transfer android source code