Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#inhmethods)

# EapSessionConfig.Builder

*** ** * ** ***


`
public
static
final

class
EapSessionConfig.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.eap.EapSessionConfig.Builder |

<br />

*** ** * ** ***

This class can be used to incrementally construct an `https://developer.android.com/reference/android/net/eap/EapSessionConfig`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#Builder()() ` Constructs and returns a new Builder for constructing an `https://developer.android.com/reference/android/net/eap/EapSessionConfig`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#build()() ` Constructs and returns an EapSessionConfig with the configurations applied to this Builder. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapAkaConfig(int,%20int,%20android.net.eap.EapSessionConfig.EapAkaOption)(int subId, int apptype, https://developer.android.com/reference/android/net/eap/EapSessionConfig.EapAkaOption options) ` Sets the configuration for EAP AKA with options. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapAkaConfig(int,%20int)(int subId, int apptype) ` Sets the configuration for EAP AKA. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapAkaPrimeConfig(int,%20int,%20java.lang.String,%20boolean)(int subId, int apptype, https://developer.android.com/reference/java/lang/String networkName, boolean allowMismatchedNetworkNames) ` Sets the configuration for EAP AKA'. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapIdentity(byte[])(byte[] eapIdentity) ` Sets the client's EAP Identity. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapMsChapV2Config(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String username, https://developer.android.com/reference/java/lang/String password) ` Sets the configuration for EAP MSCHAPv2. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapSimConfig(int,%20int)(int subId, int apptype) ` Sets the configuration for EAP SIM. |
| ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | ` https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder#setEapTtlsConfig(java.security.cert.X509Certificate,%20android.net.eap.EapSessionConfig)(https://developer.android.com/reference/java/security/cert/X509Certificate serverCaCert, https://developer.android.com/reference/android/net/eap/EapSessionConfig innerEapSessionConfig) ` Sets the configuration for EAP-TTLS. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### Builder

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder ()
```

Constructs and returns a new Builder for constructing an `https://developer.android.com/reference/android/net/eap/EapSessionConfig`.

<br />

## Public methods

### build

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig build ()
```

Constructs and returns an EapSessionConfig with the configurations applied to this
Builder.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig` | the EapSessionConfig constructed by this Builder. This value cannot be `null`. <br /> |

### setEapAkaConfig

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapAkaConfig (int subId, 
                int apptype, 
                EapSessionConfig.EapAkaOption options)
```

Sets the configuration for EAP AKA with options.

<br />

| Parameters ||
|---|---|
| `subId` | `int`: int the client's subId to be authenticated. <br /> |
| `apptype` | `int`: the apptype to be used for authentication. Value is one of the following: - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_SIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_USIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_RUIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_CSIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_ISIM` |
| `options` | `EapSessionConfig.EapAkaOption`: optional configuration for EAP AKA. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setEapAkaConfig

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapAkaConfig (int subId, 
                int apptype)
```

Sets the configuration for EAP AKA.

<br />

| Parameters ||
|---|---|
| `subId` | `int`: int the client's subId to be authenticated. <br /> |
| `apptype` | `int`: the apptype to be used for authentication. Value is one of the following: - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_SIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_USIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_RUIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_CSIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_ISIM` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setEapAkaPrimeConfig

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapAkaPrimeConfig (int subId, 
                int apptype, 
                String networkName, 
                boolean allowMismatchedNetworkNames)
```

Sets the configuration for EAP AKA'.

<br />

| Parameters ||
|---|---|
| `subId` | `int`: int the client's subId to be authenticated. <br /> |
| `apptype` | `int`: the apptype to be used for authentication. Value is one of the following: - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_SIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_USIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_RUIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_CSIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_ISIM` |
| `networkName` | `String`: String the network name to be used for authentication. This value cannot be `null`. <br /> |
| `allowMismatchedNetworkNames` | `boolean`: indicates whether the EAP library can ignore potential mismatches between the given network name and that received in an EAP-AKA' session. If false, mismatched network names will be handled as an Authentication Reject message. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setEapIdentity

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapIdentity (byte[] eapIdentity)
```

Sets the client's EAP Identity.

<br />

| Parameters ||
|---|---|
| `eapIdentity` | `byte`: byte\[\] representing the client's EAP Identity. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setEapMsChapV2Config

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapMsChapV2Config (String username, 
                String password)
```

Sets the configuration for EAP MSCHAPv2.

<br />

| Parameters ||
|---|---|
| `username` | `String`: String the client account's username to be authenticated. This value cannot be `null`. <br /> |
| `password` | `String`: String the client account's password to be authenticated. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to faciliate chaining. This value cannot be `null`. <br /> |

### setEapSimConfig

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapSimConfig (int subId, 
                int apptype)
```

Sets the configuration for EAP SIM.

<br />

| Parameters ||
|---|---|
| `subId` | `int`: int the client's subId to be authenticated. <br /> |
| `apptype` | `int`: the apptype to be used for authentication. Value is one of the following: - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_SIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_USIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_RUIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_CSIM` - `https://developer.android.com/reference/android/telephony/TelephonyManager#APPTYPE_ISIM` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |

### setEapTtlsConfig

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public EapSessionConfig.Builder setEapTtlsConfig (X509Certificate serverCaCert, 
                EapSessionConfig innerEapSessionConfig)
```

Sets the configuration for EAP-TTLS.

Tunneled EAP-TTLS authentications are disallowed, as running multiple layers of
EAP-TTLS increases the data footprint but has no discernible benefits over a single
EAP-TTLS session with a non EAP-TTLS method nested inside it.

<br />

| Parameters ||
|---|---|
| `serverCaCert` | `X509Certificate`: the CA certificate for validating the received server certificate(s). If a certificate is provided, it MUST be the root CA used by the server, or authentication will fail. If no certificate is provided, any root CA in the system's truststore is considered acceptable. This value may be `null`. <br /> |
| `innerEapSessionConfig` | `EapSessionConfig`: represents the configuration for the inner EAP instance. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder` | Builder this, to facilitate chaining. This value cannot be `null`. <br /> |