Code example for NsdManager

Methods: stopServiceDiscovery

0
			@Override 
			public void onStartDiscoveryFailed(String serviceType, int errorCode) {
				Log.d(TAG,
						"DiscoveryListener#onStartDiscoveryFailed errorCode=" 
								+ errorCode);
				mNsdManager.stopServiceDiscovery(this);
			} 
 
			@Override 
			public void onServiceFound(final NsdServiceInfo service) {
				Log.d(TAG, "DiscoveryListener#onServiceFound service="
						+ service);
				if (!service.getServiceType().equals(sServiceType)) {
					Log.d(TAG,
							"Unknown Service Type: " + service.getServiceType());
				} else if (service.getServiceName().startsWith(mServiceName)) {
					// 少し乱暴だけど、同一マシンが "わかめ (2)" とかいって複数検出されるので。 
					Log.d(TAG, "Same machine: " + mServiceName);
				} else { 
					Log.d(TAG, "New service found: " + mServiceList.size());
					addToList(service);