Code example for NsdManager

Methods: discoverServices

0
    } 
 
    public void startDiscovery() { 
	if (!discoveryStarted && !isDiscoverRunning) {
	    Log.d(TAG, "Start discovery");
	    nsdMgr.discoverServices("_p2pShare._tcp", NsdManager.PROTOCOL_DNS_SD, discoveryListener);
	    isDiscoverRunning = true;
	} 
    } 
 
    public boolean isDiscoveryStarted() { 
	return discoveryStarted;
    } 
 
    public void stopDiscovery() { 
	if (discoveryStarted) {
	    nsdMgr.stopServiceDiscovery(discoveryListener);
	    discoveryStarted = false;
	} 
    }