Builder


class Builder
kotlin.Any
   ↳ 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

Constructs a Builder with default values (see Builder).

Public methods
SoftApConfiguration

Builds the SoftApConfiguration.

SoftApConfiguration.Builder

Specifies the channels and associated bands for the APs.

Public constructors

Builder

Builder()

Constructs a Builder with default values (see Builder).

Public methods

build

fun build(): SoftApConfiguration

Builds the SoftApConfiguration.

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

setChannels

fun setChannels(channels: SparseIntArray): SoftApConfiguration.Builder

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 BAND_2GHZ with the special channel value 0 which has the framework auto-select from BAND_2GHZ.

Parameters
channels SparseIntArray: SparseIntArray (key: BandType , value: channel) consists of BAND_ and corresponding channel. This value cannot be null.
Return
SoftApConfiguration.Builder Builder for chaining. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException when more than 2 channels are set or the invalid channel or band type is configured.