SoftApConfiguration.Builder


public static final class SoftApConfiguration.Builder
extends Object

java.lang.Object
   ↳ android.net.wifi.SoftApConfiguration.Builder


Builds a SoftApConfiguration, which allows an app to configure various aspects of a Soft AP. All fields are optional. By default, SSID and BSSID are automatically chosen by the framework, and an open network is created.

Summary

Public constructors

Builder()

Constructs a Builder with default values (see Builder).

Public methods

SoftApConfiguration build()

Builds the SoftApConfiguration.

SoftApConfiguration.Builder setChannels(SparseIntArray channels)

Specifies the channels and associated bands for the APs.

Inherited methods

Public constructors

Builder

public Builder ()

Constructs a Builder with default values (see Builder).

Public methods

build

public SoftApConfiguration build ()

Builds the SoftApConfiguration.

Returns
SoftApConfiguration A new SoftApConfiguration, as configured by previous method calls. This value cannot be null.

setChannels

public SoftApConfiguration.Builder setChannels (SparseIntArray channels)

Specifies the channels and associated bands for the APs.

The API contains (band, channel) input since the 6GHz band uses the same channel numbering scheme as is used in the 2.4GHz and 5GHz band. Therefore, both are needed to uniquely identify individual channels.

Reference the Wi-Fi channel numbering and the channelization in IEEE 802.11-2016 specifications, section 17.3.8.4.2, 17.3.8.4.3 and Table 15-6.

Using the special value 0 which has the framework auto-select a valid channel from the band configured. When more than 1 channel/band is set, this will bring up concurrent APs on the requested channels and bands (if possible). Use WifiManager.isBridgedApConcurrencySupported() to determine whether concurrent APs are supported. If not set, the default value is SoftApConfiguration.BAND_2GHZ with the special channel value 0 which has the framework auto-select from SoftApConfiguration.BAND_2GHZ.

Parameters
channels SparseIntArray: SparseIntArray (key: #BandType , value: channel) consists of BAND_ and corresponding channel. This value cannot be null.

Returns
SoftApConfiguration.Builder Builder for chaining. This value cannot be null.

Throws
IllegalArgumentException when more than 2 channels are set or the invalid channel or band type is configured.