title: Set up a Wifi-Direct connection between Android and Raspberry Pi 3 Linux
body: <p>I want to connect two devices using Wifi-Direct. One is a RaspBerry PI 3 (with Raspbian Jessie), the other is an Android smartphone. Raspberry as server and Android as client.</p>
  
  <p>I decided to use wpa_supplicant in Raspbian and the WifiDirect example app for Android:</p>
  
  <p><a href="https://developer.android.com/guide/topics/connectivity/wifip2p.html" rel="noreferrer">https://developer.android.com/guide/topics/connectivity/wifip2p.html</a></p>
  
  <p>My wpa_supplicant.conf contains:</p>
  
  <pre><code>ctrl_interface=/var/run/wpa_supplicant
  update_config=1 
  device_name=raspberry
  device_type=1-0050F204-1
  driver_param=use_p2p_group_interface=1
  p2p_go_intent=1
  p2p_go_ht40=1
  </code></pre>
  
  <p>I am following this steps:</p>
  
  <p>1) In the raspberry pi:</p>
  
  <pre><code>sudo wpa_supplicant  -B -iwlan0 -Dnl80211 -c/etc/wpa_supplicant.conf
  sudo wpa_cli -iwlan0 p2p_group_add
  ifconfig p2p-wlan0-0 192.168.1.2
  wpa_cli -ip2p-wlan0-0 wps_pbc
  </code></pre>
  
  <p>2) Then in the Android app, I can see the raspberry as a peer but I get a connection failure.
  I try with the settings app (<em>Wifi => Advanced => Wifi Direct</em>) and I can see the raspberry as a peer too but the diference is that when I try to make the connection, the application request me a PIN code and I am able to make the connection if I introduce the pin returned by p2p_pin any in the raspberry.</p>
  
  <p>Im trying to understand this behavior:</p>
  
  <p><strong>Why is requesting me a PIN? This is the reason why I am not able to make the connection through the WifiDirect example app? Im missing something here?</strong></p>
  
  <p>Thank you.</p>