private void discoverService() {
        /*
         * Register listeners for DNS-SD services. These are callbacks invoked
         * by the system when a service is actually discovered.
         */
        mManager.setDnsSdResponseListeners(mChannel,
                new CustomDnsServiceResponseListener(this), new CustomDnsSdTxtRecordListener());

        // After attaching listeners, create a service request and initiate
        // discovery.
        WifiP2pDnsSdServiceRequest mServiceRequest = WifiP2pDnsSdServiceRequest.newInstance();

        //initiates discovery
        mManager.addServiceRequest(mChannel, mServiceRequest,
                new CustomizableActionListener(
                        this.mContext,
                        TAG,
                        "Added service discovery request",
                        null,
                        "Failed adding service discovery request",
                        "Failed adding service discovery request",
                        true)); //important: sets true to get detailed message when this method fails

        //starts services discovery
        mManager.discoverServices(mChannel,
                new CustomizableActionListener(
                        this.mContext,
                        TAG,
                        "Service discovery initiated",
                        null,
                        "Failed starting service discovery",
                        "Failed starting service discovery",
                        true)); //important: sets true to get detailed message when this method fails
    }
private void discoverService() {
        
        mManager.setDnsSdResponseListeners(mChannel,
                new CustomDnsServiceResponseListener(this), new CustomDnsSdTxtRecordListener());

        
        
        WifiP2pDnsSdServiceRequest mServiceRequest = WifiP2pDnsSdServiceRequest.newInstance();

        
        mManager.addServiceRequest(mChannel, mServiceRequest,
                new CustomizableActionListener(
                        this.mContext,
                        TAG,
                        "Added service discovery request",
                        null,
                        "Failed adding service discovery request",
                        "Failed adding service discovery request",
                        true)); 

        
        mManager.discoverServices(mChannel,
                new CustomizableActionListener(
                        this.mContext,
                        TAG,
                        "Service discovery initiated",
                        null,
                        "Failed starting service discovery",
                        "Failed starting service discovery",
                        true)); 
    }
private void discoverService ( ) { /*
         * Register listeners for DNS-SD services. These are callbacks invoked
         * by the system when a service is actually discovered.
         */ mManager . setDnsSdResponseListeners ( mChannel , new CustomDnsServiceResponseListener ( this ) , new CustomDnsSdTxtRecordListener ( ) ) ; // After attaching listeners, create a service request and initiate // discovery. WifiP2pDnsSdServiceRequest mServiceRequest = WifiP2pDnsSdServiceRequest . newInstance ( ) ; //initiates discovery mManager . addServiceRequest ( mChannel , mServiceRequest , new CustomizableActionListener ( this . mContext , TAG , "Added service discovery request" , null , "Failed adding service discovery request" , "Failed adding service discovery request" , true ) ) ; //important: sets true to get detailed message when this method fails //starts services discovery mManager . discoverServices ( mChannel , new CustomizableActionListener ( this . mContext , TAG , "Service discovery initiated" , null , "Failed starting service discovery" , "Failed starting service discovery" , true ) ) ; //important: sets true to get detailed message when this method fails }
Method to discover services and put the results
in {@link it.polimi.spf.wfd.ServiceList}.
This method updates also the discovery menu item.
Method to discover services and put the results in {