I tried out transferring forms using wifi.
Here is the link to the code.
I have used QRCode as a method to share connection information to connect the two devices.
One of the devices acts a
Client and other as a
Server creates a hotspot and accepts
The same device creates
QRCode with the following information:
- SSID of network
- Password (will be used if the network is password protected)
- Server IP
- Port number (Port number is NOT hardcoded)
The other device(
Client) scans the QR Code.
Connects to the hotspot.
Establishes a socket connection with other devices.
Main advantages of using QR Code is :
Connection establishment becomes very easy from the user point of view.
The user need not be aware of technical details. This will be a very big advantage. I shall share usefulness of QRCode in another post.
The app uses
Content Provider to access form instances.
All the received forms are stored in
QRCode, I had used
Network Service Discovery as a method for devices to discover each other. But, for NSD to work, it requires two devices running the same app instance on the same
NSD is useless if two devices aren't connected to same Acess point. That means
NSD will be helpful only to establish
Socket connection and not Wifi connection. So, I think
NSD is of little use here.
@LN @Shobhit_Agarwal Now, the connection over wifi is easy to establish and I have transferred forms along with associated files, can it be considered as a way to achieve peer to peer sync? (Although technically it is not a peer to peer connection)