Android, NSD/DNS-SD: NsdManager unreliable discovery and IP resolution

It's probably no longer relevant, but I discovered one of the possible causes of my problem: from my experience it seems NSD behaves extremely unreliable if you do further processing within the thread of the NsdManager callback methods. Even if there is just a few lines of code, the weirdest results regarding discovery occur. So one must offload any work from the callback methods to another thread, and avoid to block the NsdManager at all costs, even for a millisecond.


Still no difference with Android NSD. I had been using Marshmallow version of Android and NSD actually is still unreliable. I replaced the NSD with RxDNSSD ( https://github.com/andriydruk/RxDNSSD ). Few liner code works perfect till now.

I tested NSD & RXDNSSD, NSD was able to discover service but not able to resolve IP address while RXDNSSD was working all the time.

Hope it will help for other users.