jMdns is a great java library to provide zeroconf/bonjour capabilities to your Android application.
I successfully using this in a project up until Android 4.0 Ice Cream Sandwich aka ICS
, once Android 4.0 devices were starting to be used more often I am facing application not working.
I have tested application in android 4.0 earlier, it show me list of Discover Devices but in android 4.0 or later it show nothing.
I've tested this demo "https://github.com/twitwi/AndroidDnssdDemo" on 4.1 but its not working.
I have written Below code based on suggestion mention in "http://snctln.com/2012/08/03/jmdns-and-android-4-0/"
private android.net.wifi.WifiManager.MulticastLock lock;
private android.os.Handler handler = new android.os.Handler();
private JmDNS jmdns = null;
public WifiManager wifi;
private void setUp()
{
WifiManager wifiMgr = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
int ip = wifiInfo.getIpAddress();
String ipAddress = Formatter.formatIpAddress(ip);
try {
jmdns.create(_bindingAddress);
ServiceInfo[] infos = jmdns.list("_afpovertcp._tcp.local.");
for (int i=0; i < infos.length; i++) {
Log.i("Servic : ",infos[i].getName()+"");
// notifyUser("\nServic : "+infos[i].getName()+"");
}
} catch (IOException e) {
e.printStackTrace();
}
}
your suggestion are appreciable