Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/os/flagging/AconfigPackage#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/os/flagging/AconfigPackage#inhmethods)

# AconfigPackage

*** ** * ** ***

` public class AconfigPackage `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.os.flagging.AconfigPackage |

<br />

*** ** * ** ***

An `aconfig` package containing the enabled state of its flags.

**Note: this is intended only to be used by generated code. To determine if a given flag is enabled in app code, the generated android flags should be used.**

This class is used to read the flag from Aconfig Package.Each instance of this class will cache information related to one package. To read flags from a different package, a new instance of this class should be `https://developer.android.com/reference/android/os/flagging/AconfigPackage#load(java.lang.String)`.

## Summary

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/os/flagging/AconfigPackage#getBooleanFlagValue(java.lang.String,%20boolean)(https://developer.android.com/reference/java/lang/String flagName, boolean defaultValue) ` Retrieves the value of a boolean flag. |
| ` static https://developer.android.com/reference/android/os/flagging/AconfigPackage` | ` https://developer.android.com/reference/android/os/flagging/AconfigPackage#load(java.lang.String)(https://developer.android.com/reference/java/lang/String packageName) ` Loads an Aconfig Package from Aconfig Storage. |

### 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 methods

### getBooleanFlagValue

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

```
public boolean getBooleanFlagValue (String flagName, 
                boolean defaultValue)
```

Retrieves the value of a boolean flag.

This method retrieves the value of the specified flag. If the flag exists within the loaded Aconfig Package, its value is returned. Otherwise, the provided \`defaultValue\` is returned.

<br />

| Parameters ||
|---|---|
| `flagName` | `String`: The name of the flag (excluding any package name prefix). This value cannot be `null`. <br /> |
| `defaultValue` | `boolean`: The value to return if the flag is not found. <br /> |

| Returns ||
|---|---|
| `boolean` | The boolean value of the flag, or \`defaultValue\` if the flag is not found. <br /> |

### load

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

```
public static AconfigPackage load (String packageName)
```

Loads an Aconfig Package from Aconfig Storage.

This method attempts to load the specified Aconfig package.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The name of the Aconfig package to load. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/flagging/AconfigPackage` | An instance of `https://developer.android.com/reference/android/os/flagging/AconfigPackage`, which may be empty if the package is not found in the container. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/os/flagging/AconfigStorageReadException` | if there is an error reading from Aconfig Storage, such as if the storage system is not found, the package is not found, or there is an error reading the storage file. The specific error code can be obtained using `https://developer.android.com/reference/android/os/flagging/AconfigStorageReadException#getErrorCode()`. |