Code example for NsdServiceInfo

Methods: getHost, getServiceName, getServiceType

0
            } 
 
            @Override 
            public void onServiceFound(NsdServiceInfo service) {
                Log.d(TAG, "Service discovery success" + service);
                if (!service.getServiceType().equals(SERVICE_TYPE)) {
                    Log.d(TAG, "Unknown Service Type: " + service.getServiceType());
                } else if (service.getHost() == null) {
                    Log.d(TAG, "Same machine: " + serviceName);
                } else if (service.getServiceName().contains(serviceName)){
                	nsdManager.resolveService(service, resolveListener);
                } 
            } 
 
            @Override 
            public void onServiceLost(NsdServiceInfo service) {
                Log.e(TAG, "service lost" + service);
                if (service.getHost() == null) {
                	mService = null;
                } 
            }