Late last year I attended another conference on mobile media. Most of it was pretty wishy-washy, and as my mind wandered I got to thinking about peer-to-peer mobile communications.
In the past it was all peer-to-peer – voice, video, and SMS – but these days, when it comes to data it’s all client-server. And I wondered, is there any way to do peer-to-peer data comms with an Android handset? Preferably between two phones that are both off the grid? Here’s what I found …
- Bluetooth should work fine, except it was only enabled in Android 2.0 and my phone is 1.6. I’ve got a new phone arriving soon, so hopefully I can root the old one and install 2.3 on it. Then I’ll be able to test bluetooth between two working phones.
- Ad-hoc wi-fi isn’t supported by Android, despite lots of requests from developers. So it isn’t possible to communicate via an ad-hoc wi-fi network.
- Recent versions of Android allow you to create a wi-fi hotspot by turning your phone into a hub. Presumably additional phones could join that subnet and start communicating. What isn’t clear is whether the first phone needs a connection to the internet before it can go into hub mode. I guess I’ll find out when I get the new phone.
- Since phones are designed to be internet clients, peer-to-peer IP communications are tricky. If they’re on the same subnet you can presumably use broadcast address 255.255.255.255 to announce your presence, and hopefully the other phones will get in touch. Otherwise, they’re probably separated by NAT gateways, in which case you need a STUN server or similar to reach them. Since I have no interest in writing a STUN client for Android I’m going to ignore that option.
And what will I do once I get peer-to-peer comms working reliably? Write a walkie-talkie app of course, allowing point-to-point or broadcast to all known peers. Ideally supporting both bluetooth and wi-fi subnet techniques.