JmDNS on Android

3.1k views Asked by At

Have you succeeded in service discovery using jmdns in Android? I'm facing same problem not able to discover services using jmdns in Android.

From my code using jmdns I am trying to discover services of type:

jmdns.addServiceListener("_afpovertcp._tcp.", listener);
ServiceInfo[] infos = jmdns.list("_afpovertcp._tcp."); 

I have installed _afpovertcp._tcp service type (Avahi package) on my Linux Ubuntu PC. My Android phone with my code and linux machine both are configured to WI-FI. Still not able to discover my Linux PC.

2

There are 2 answers

0
RaphMclee On

Add the internet permission to your manifest.xml

<uses-permission android:name="android.permission.INTERNET" />

In addition you have to implement the listener. Can you show us your implementation? It has to look like here: Samples with JmDNS

0
Melloware On

Yes make sure you are using the latest jMDNS from Sourceforge in their SVN repo and you can see our example in Android here from our open source app.

http://code.google.com/p/tunesremote-plus/source/browse/trunk/src/org/tunesremote/LibraryActivity.java