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

后端 未结 5 756
臣服心动
臣服心动 2020-11-30 18:42

I\'m working with a Droid / Android 2.0.1 and encountering an issue apparently many people have: I\'m unable to discover services using the one pure-Java zeroconf library I

5条回答
  •  爱一瞬间的悲伤
    2020-11-30 19:01

    Have you explicitly acquired the multicast lock so that you can receive the multicast packets?

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

    According to that Android Issue thread it looks like 2.0.1 doesn't have the fix. Perhaps you should transition to a later release?

提交回复
热议问题