I can\'t resolve one service while another is being resolved? If that\'s what the error means... What is the way to wait until it is resolved?
@Override
public v
I had this problem as well, and had been following the Android NsdHelper implementation laid out in NsdChat here. This example shows creating a single NsdManager.ResolveListener mResolveListener in the NsdHelper class, and using that ResolveListener for all calls to NsdManager.resolveService.
From here I read that "a separate Listener is to be used for each active registration or discovery request".
So instead of using a class variable mResolveListener, create a new listener every time you call mNsdManager.resolveService:
@Override
public void onServiceFound(NsdServiceInfo serviceInfo) {
Log.d(TAG, "Service found: "+ serviceInfo);
if (serviceInfo.getServiceType().equals(SERVICE_TYPE)){
mNsdManager.resolveService(serviceInfo, new NsdManager.ResolveListener() {
@Override
public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) {
Log.e(TAG, "Resolve Failed: " + serviceInfo);
}
@Override
public void onServiceResolved(NsdServiceInfo serviceInfo) {
Log.i(TAG, "Service Resolved: " + serviceInfo);
}
});
}
}