Home | History | Annotate | Download | only in WiFiDirectDemo
      1 <p>This is a demo application highlighting how to make peer to peer network connections with
      2 the Wi-Fi Direct APIs.  The application allows you to transfer jpeg images from the gallery after a succesful connection.</p>
      3 
      4 <p>The source code for this demo app shows how to accomplish three key things
      5 with Wi-Fi Direct APIs: Discovering peers, connecting using Wi-Fi Direct APIs, and finding group details post connection, so that a 
      6 TCP socket can be opened to transfer files.</p>
      7 
      8 <p>The application includes:<p>
      9 <ul> <li><a
     10     href="src/com/example/android/wifidirect/WiFiDirectActivity.html"><code>WiFiDirectActivity</code></a>
     11   &mdash; the main <code>Activity</code> that contains two fragments to handle app's UI and peer lifecycle. It also registers a broadcast receiver for Wi-Fi Direct related events.</li> <li><a
     12     href="src/com/example/android/wifidirect/WiFiDirectBroadcastReceiver.html"><code>
     13       WiFiDirectBroadcastReceiver</code></a> &mdash; a <code>BroadcastReceiver</code>
     14   that listens for Wi-Fi Direct related events and passes them to
     15   <code>WiFiDirectActivity</code> and it's fragments for neccesary action.</li> <li><a
     16     href="src/com/example/android/wifidirect/DeviceListFragment.html"><code>DeviceListFragment</code></a>
     17   &mdash; a <code>ListFragment</code> that displays available peers and their status. </li>
     18 <li><a href="src/com/example/android/wifidirect/DeviceDetailFragment.html"><code>DeviceDetailFragment</code></a>
     19   &mdash; a <code>Fragment</code> that displays the details of the selected device and also drives the connection, disonnection and data transfer functionality of the demo. </li>
     20 <li><a href="src/com/example/android/wifidirect/FileTransferService.html"><code>FileTransferService</code></a>
     21   &mdash; an <code>IntentService</code> that services file transfer requests from the application by using TCP sockets. </li> </ul>
     22 <p>If you are developing an application that uses the Wi-Fi Direct APIs, remember that the
     23 feature is supported only on Android 4.0 (API level 14) and higher versions of
     24 the platform. To ensure that your application can only
     25 be installed on devices that are capable of supporting Wi-Fi Direct mode, remember to add the
     26 following to the application's manifest before publishing to Google Play:</p>
     27 <ul> <li><code>&lt;uses-sdk android:minSdkVersion="14" /&gt;</code>, which
     28   indicates to Google Play and the platform that your application requires
     29   Android 4.0 or higher. For more information, see <a
     30     href="../../../guide/appendix/api-levels.html">API Levels</a> and the
     31   documentation for the <a
     32     href="../../../guide/topics/manifest/uses-sdk-element.html"><code>&lt;uses-sdk&gt;</code></a>
     33   element.</li> </ul> <p>To control how Google Play filters your application
     34 from devices that do not support Wi-Fi Direct mode, remember to add the following to the
     35 application's manifest <ul> <li><code>&lt;uses-feature
     36     android:name="android.hardware.wifi.direct" /&gt;</code>, which tells Google
     37   Play that your application uses the Wi-Fi Direct API. The declaration should include
     38   an <code>android:required</code> attribute that indicates whether you want
     39   Google Play to filter the application from devices that do not offer Wi-Fi Direct support. Other <code>&lt;uses-feature&gt;</code> declarations may also be
     40   needed, depending on your implementation. For more information, see the
     41   documentation for the <a
     42     href="../../../guide/topics/manifest/uses-feature-element.html"><code>&lt;uses-feature&gt;</code></a>
     43   element.</li> </ul>
     44 <p>For more information about using the Wi-Fi Direct API, see the <a
     45   href="../../../reference/android/net/wifi/p2p/package-summary.html"><code>android.net.wifi.p2p	</a></code>
     46 documentation. </p>
     47 
     48 <img alt="" src="../images/WifiDirect.png" />
     49 
     50