Code example for NsdManager

Methods: registerService

0
	public static void destroy() { 
		try { 
			running = false;
			Log.i(TAG, "Stopping NSD Service");
			mNsdManager.unregisterService(mRegistrationListener);
		} catch(Exception e) {
			Log.e(TAG, "Error: NSD service stopped before being registered");
		} 
	} 
 
	public static void unregisterService() { 
		mNsdManager.unregisterService(mRegistrationListener);
	} 
 
	private static void registerService(int port) {
		NsdServiceInfo serviceInfo = new NsdServiceInfo();
 
		serviceInfo.setServiceName(Build.SERIAL + "TEST-TEST"
				+ new Date().getTime());
		serviceInfo.setServiceType(SERVICE_TYPE);
		serviceInfo.setPort(port);