Android Multicast/Zeroconf

I'm working with SwipSwap to create an android port of an iPhone app that does group contact swaps. The group is discovered using zeroconf over a wifi connection. There has been some confusion about the state of multicast support in android, as documented in Ticket #2917. It was cleared up recently.

Android 1.5 and 1.6 devices look to support the reception of multicast packets under some unknown condition - they cant be relied upon to always work. On android 1.6 or later, an explicit multicast lock must be requested in order to receive multicast packets.

AndroidManifest.xml:

Networking code: WifiManager wifi = (WifiManager)getSystemService(Context.WIFI_SERVICE); MulticastLock lock = wifi.createMulticastLock("mylock"); lock.acquire();

/typo:code

Multicast is the foundation for peer discovery using zeroconf. We're using the JmDNS java package to make this work. Registering a service on the network is working. Receiving a neighbor announcement, even with the wifi multicast lock, is not working yet.

tags: