Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#constants) \| [Inherited Constants](https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#inhconstants) \| [Fields](https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#lfields) \| [Ctors](https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#pubctors) \| [Methods](https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#inhmethods)

# WifiSsidPolicy

*** ** * ** ***


`
public

final

class
WifiSsidPolicy
`


`

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


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.admin.WifiSsidPolicy |

<br />

*** ** * ** ***

Used to indicate the Wi-Fi SSID restriction policy the network must satisfy in order to be
eligible for a connection.

If the policy type is a denylist, the device may not connect to networks on the denylist. If
the policy type is an allowlist, the device may only connect to networks on the allowlist. Admin
configured networks are not exempt from this restriction. This policy only prohibits connecting
to a restricted network and does not affect adding a restricted network. If the current network
is present in the denylist or not present in the allowlist, it will be disconnected.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_ALLOWLIST` SSID policy type indicator for `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy`. |
| `int` | `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_DENYLIST` SSID policy type indicator for `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy`. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that
the Parcelable object's flattened representation includes a file descriptor.


`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written
is a return value, that is the result of a function such as
"`Parcelable someFunction()`",
"`void someFunction(out Parcelable)`", or
"`void someFunction(inout Parcelable)`".


| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/app/admin/WifiSsidPolicy>` | `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#CREATOR` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WifiSsidPolicy(int,%20java.util.Set<android.net.wifi.WifiSsid>)(int policyType, https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/android/net/wifi/WifiSsid> ssids) ` Create the Wi-Fi SSID Policy. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object thatObject) ` Two instances of WifiSsidPolicy are considered equal if they have the same WifiSsidPolicyType and the same set of WifiSsids |
| ` int` | ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#getPolicyType()() ` Returns the policy type. |
| ` https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/android/net/wifi/WifiSsid>` | ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#getSsids()() ` Returns the set of `https://developer.android.com/reference/android/net/wifi/WifiSsid` |
| ` int` | ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#hashCode()() ` Returns the hash code value of WifiSsidPolicyType and WifiSsid set |
| ` void` | ` https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

### 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*.


From interface `

https://developer.android.com/reference/android/os/Parcelable

` `
abstract


int` `
https://developer.android.com/reference/android/os/Parcelable#describeContents()()
`

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.


`
abstract


void` `
https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags)
`

Flatten this object in to a Parcel.


## Constants

### WIFI_SSID_POLICY_TYPE_ALLOWLIST

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

```
public static final int WIFI_SSID_POLICY_TYPE_ALLOWLIST
```

SSID policy type indicator for `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy`.

When returned from `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#getPolicyType()`, the constant indicates that the
SSID policy type is an allowlist.

<br />

**See also:**

- `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_DENYLIST`

Constant Value:

0
(0x00000000)


### WIFI_SSID_POLICY_TYPE_DENYLIST

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

```
public static final int WIFI_SSID_POLICY_TYPE_DENYLIST
```

SSID policy type indicator for `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy`.

When returned from `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#getPolicyType()`, the constant indicates that the
SSID policy type is a denylist.

<br />

**See also:**

- `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_ALLOWLIST`

Constant Value:

1
(0x00000001)


## Fields

### CREATOR

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

```
public static final Creator<WifiSsidPolicy> CREATOR
```

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/os/Parcelable.Creator`

## Public constructors

### WifiSsidPolicy

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

```
public WifiSsidPolicy (int policyType, 
                Set<WifiSsid> ssids)
```

Create the Wi-Fi SSID Policy.

<br />

| Parameters ||
|---|---|
| `policyType` | `int`: indicate whether the policy is an allowlist or a denylist. Value is one of the following: - `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_ALLOWLIST` - `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_DENYLIST` |
| `ssids` | `Set`: set of `https://developer.android.com/reference/android/net/wifi/WifiSsid` This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the input ssids set is empty or the policyType is invalid |

## Public methods

### describeContents

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

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

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

```
public boolean equals (Object thatObject)
```

Two instances of WifiSsidPolicy are considered equal if they have the same WifiSsidPolicyType
and the same set of WifiSsids

<br />

| Parameters ||
|---|---|
| `thatObject` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getPolicyType

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

```
public int getPolicyType ()
```

Returns the policy type.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_ALLOWLIST` - `https://developer.android.com/reference/android/app/admin/WifiSsidPolicy#WIFI_SSID_POLICY_TYPE_DENYLIST` |

### getSsids

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

```
public Set<WifiSsid> getSsids ()
```

Returns the set of `https://developer.android.com/reference/android/net/wifi/WifiSsid`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/android/net/wifi/WifiSsid>` | This value cannot be `null`. <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns the hash code value of WifiSsidPolicyType and WifiSsid set

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |