How to Discover Zeroconf (Bonjour) Services on Android? I'M Having Trouble with Jmdns

How can I discover zeroconf (Bonjour) services on Android? I'm having trouble with jmDNS

I'm new as well otherwise I would have just left a comment on smountcastle's answer which is mostly correct. I have just been dealing with the exact same issue on a Droid running Android 2.1. I found that I needed to set the MulticastLock to reference-counted otherwise it seemed to be released automatically.

AndroidManifest.xml:
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

// Networking code:
WifiManager wifi = getSystemService( Context.WIFI_SERVICE );
MulticastLock lock = wifi.createMulticastLock("fliing_lock");
lock.setReferenceCounted(true);
lock.acquire();

Just make sure to call lock.release() when you're done with it. This may only be necessary for Android 2.0+, The Droid is my only test device currently, so I can't say for sure.

Android - iOS zero conf network discovery with jmDNS broken

Switching to Android's native network discovery (NsdManager) this is no longer a problem. It seems to be an incompatibility between jmDNS and iOS 8 / OS X 10.10.

Locate services using Zeroconf with JmDNS on local device AP(hotspot)

It is not possible to use multicast on a local hotspot since it's not possible to acquire the multicast lock. Thus JmDNS will not work.

For anyone else having this problem, the alternative solution of finding connected devices I ended up using is based on parsing /proc/net/arp



Related Topics



Leave a reply



Submit