Skip to content

Most visited

Recently visited

navigation
added in API level 26

android.net.wifi.aware

Provides classes which allow applications to use Wi-Fi Aware to discover peers and create connections to them.

Using the Wi-Fi Aware APIs, applications can advertise services, discover peers which are advertising services, and connect to them. Wi-Fi Aware is independent of Wi-Fi infrastructure (i.e. a device may or may not be associated with an AP concurrent to using Wi-Fi Aware).

The primary entry point to Wi-Fi Aware capabilities is the WifiAwareManager class, which is acquired by calling Context.getSystemService(Context.WIFI_AWARE_SERVICE)

Some APIs may require the following user permissions:

Note: Not all Android-powered devices support Wi-Fi Aware functionality. If your application only works with Wi-Fi Aware (i.e. it should only be installed on devices which support Wi-Fi Aware), declare so with a <uses-feature> element in the manifest file:

<manifest ...>
    <uses-feature android:name="android.hardware.wifi.aware" />
    ...
</manifest>

Alternatively, if you application does not require Wi-Fi Aware but can take advantage of it if available, you can perform the check at run-time in your code using hasSystemFeature(String) with FEATURE_WIFI_AWARE:

    getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_AWARE)

Classes

AttachCallback Base class for Aware attach callbacks. 
Characteristics The characteristics of the Wi-Fi Aware implementation. 
DiscoverySession A class representing a single publish or subscribe Aware session. 
DiscoverySessionCallback Base class for Aware session events callbacks. 
IdentityChangedListener Base class for a listener which is called with the MAC address of the Aware interface whenever it is changed. 
PeerHandle Opaque object used to represent a Wi-Fi Aware peer. 
PublishConfig Defines the configuration of a Aware publish session. 
PublishConfig.Builder Builder used to build PublishConfig objects. 
PublishDiscoverySession A class representing a Aware publish session. 
SubscribeConfig Defines the configuration of a Aware subscribe session. 
SubscribeConfig.Builder Builder used to build SubscribeConfig objects. 
SubscribeDiscoverySession A class representing a Aware subscribe session. 
WifiAwareManager This class provides the primary API for managing Wi-Fi Aware operations: discovery and peer-to-peer data connections. 
WifiAwareSession This class represents a Wi-Fi Aware session - an attachment to the Wi-Fi Aware service through which the app can execute discovery operations. 
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)