1

I have multiple smartphones or tablets, where Android is 4.4 and above. There is a few ways, how to connect this devices between each other with:

  1. WiFi - if they are connected to the same network and they are connected
  2. Bluetooth - there is a limitation for distance between this devices
  3. WiFi Direct - it's offline, but it's not stable. I already tried a many examples and libraries, but there isn't even stability between this devices, when I'm trying to reach a connection between them. Even the documentation is very poorly written.
  4. Google Nearby - once again, it uses a multiple sensors + Bluetooth + WiFi + Network cell and so on. - but I need to be connected to the internet
  5. NFC - too short
  6. Cloud stuff - something I don't want to

Is there a way how a multiple devices could send data between each other without internet connection (WiFi could be turned ON, but no connection with network). For instance offline socket connection through WiFi or anything else? This case is trying to solve moments, when server is not available, but the actions done on the first smartphone could be sended to second smartphone without any interogations from the customer. Any help?

jantursky
  • 1,122
  • 1
  • 10
  • 21

3 Answers3

1

You could achieve that by having the devices on the same network. One of them could start a web server and the other one can connect to it via sockets. There are plenty of libraries available for that.

Murat Karagöz
  • 35,401
  • 16
  • 78
  • 107
0

Yes sure! As noted by @jantursky, you can have a apache server on one of the PC by which connecting all your smartphones and Tablets to it can automatically give you instance of connectivity among all of them!
I have tried it so many times, so yes you can too get it done!
Better to look upon: https://stackoverflow.com/a/42923433/5506381

I hope this will sort out your query!

Ramneek
  • 1
  • 3
0

You can communicate with these devices as long as they are connected to the same router in the network, if the router changes in the same network the devices will not pass through the router and connect to server on other router.

Then you have to manually give static I.P address to your server in your router settings using MAC address of server for identifying device. Other devices will store the i.p address of server in their code.

Next if you have a computer in network it would be easy to setup server with it. Server can store the details of each device connected and share to other devices list with i.p addresses. This setup helps in direct device-device communication but can fail if other device's i.p address changes.

You can go for only client-server model and show other devices only the list of devices and delegate the routing of communication to server as server will have updated information of communication channel with each device.

This setup can also be done with a mobile device but can break as the mobile devices have restricted communication or power usage if put into lock mode.

Umar Hussain
  • 3,461
  • 1
  • 16
  • 38