This is a demo application highlighting how to advertise and discover local services that are Wi-Fi peer to peer network capable with the Wi-Fi Direct Service Discovery APIs. Service discovery on Wi-Fi direct allows applications to discover and enagage with peers that support a certain service. As an example, a gaming application can find and associate with devices that support the game. This application allows you to chat with a peer after a succesful connection.

The source code for this demo app shows how to accomplish three key things with Wi-Fi Direct Service Discovery APIs: Advertise services, discover services and connect to peers advertising such services

The application includes:

  • GroupOwnerSocketHandler — a Thread that implements a client side Socket handler.
  • If you are developing an application that uses the Wi-Fi Direct Service Discovery APIs, remember that the feature is supported only on Android 4.1 (API level 16) and higher versions of the platform. To ensure that your application can only be installed on devices that are capable of supporting Wi-Fi Direct Service Discovery, remember to add the following to the application's manifest before publishing to Google Play:

    To control how Google Play filters your application from devices that do not support Wi-Fi Direct mode, remember to add the following to the application's manifest

    For more information about using the Wi-Fi Direct Service Discovery APIs, see the android.net.wifi.p2p documentation.