Code example for NsdManager

Methods: resolveService

0
 
	public static void initializeDiscoveryListener() { 
 
		mDiscoveryListener = new NsdManager.DiscoveryListener() {
 
			@Override 
			public void onDiscoveryStarted(String regType) {
				Log.d(TAG, "Service discovery started");
			} 
 
			@Override 
			public void onServiceFound(NsdServiceInfo service) {
				Log.d(TAG, "Service discovery success");
				Log.d(TAG, String.format("%s %s %s %d",
						service.getServiceName(), service.getServiceType(),
						service.getHost(), service.getPort()));
				if (!service.getServiceType().contains(SERVICE_TYPE)) {
					Log.d(TAG,
							"Unknown Service Type: " + service.getServiceType());
				} else if (service.getServiceName().equals(mServiceName)) {
					Log.d(TAG, "Same machine: " + mServiceName);