Code example for WifiP2pManager

Methods: connect

0
        @SuppressWarnings("unused") 
        public void onConnectionRequested(WifiP2pDevice device, WifiP2pConfig config) {
            Log.d(TAG, "onConnectionRequested");
            Log.d(TAG, "    device: " + device.deviceAddress + " " + device.deviceName);
            Log.d(TAG, "    config: " + config.wps.setup + " " + config.wps.pin);
            manager.connect(channel, config, new ActionListener() {
 
                                @Override 
                                public void onSuccess() { 
                                    // WiFiDirectBroadcastReceiver will notify us. Ignore for now. 
                                } 
 
                                @Override 
                                public void onFailure(int reason) {
                                    Log.d(TAG, "Connect failed");
                                } 
                            }); 
        } 
 
        /** 
         * Callback to report successful registration of this object.