# KeyedAppState

Artifact: [androidx.enterprise:enterprise-feedback](https://developer.android.com/jetpack/androidx/releases/enterprise) [View Source](https://cs.android.com/search?q=file:androidx/enterprise/feedback/KeyedAppState.java+class:androidx.enterprise.feedback.KeyedAppState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

*** ** * ** ***


```
@AutoValue
abstract class KeyedAppState
```

<br />

*** ** * ** ***

A keyed app state to be sent to an EMM (enterprise mobility management), with the intention that it is displayed to the management organization.

## Summary

| ### Nested types |
|---|
| `@https://www.javadoc.io/doc/com.google.auto.value/auto-value/latest/com/google/auto/value/AutoValue.Builder.html abstract class https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState.KeyedAppStateBuilder` The builder for `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState`. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#MAX_DATA_LENGTH() = 1000` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxDataLength()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#MAX_KEY_LENGTH() = 100` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxKeyLength()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#MAX_MESSAGE_LENGTH() = 1000` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxMessageLength()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#SEVERITY_ERROR() = 2` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#SEVERITY_INFO() = 1` |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState.KeyedAppStateBuilder` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#builder()()` Create a `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState.KeyedAppStateBuilder`. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getData()()` Optionally, a machine-readable value to be read by the EMM. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getKey()()` The key for the app state. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxDataLength()()` Get the maximum length of `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getData()`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxKeyLength()()` Get the maximum length of `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getKey()`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxMessageLength()()` Get the maximum length of `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMessage()`. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMessage()()` Optionally, a free-form message string to explain the app state. |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getSeverity()()` The severity of the app state. |

## Constants

### MAX_DATA_LENGTH

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.1.0)

```
const val MAX_DATA_LENGTH = 1000: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxDataLength()`

### MAX_KEY_LENGTH

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.1.0)

```
const val MAX_KEY_LENGTH = 100: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxKeyLength()`

### MAX_MESSAGE_LENGTH

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.1.0)

```
const val MAX_MESSAGE_LENGTH = 1000: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMaxMessageLength()`

### SEVERITY_ERROR

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
const val SEVERITY_ERROR = 2: Int
```

### SEVERITY_INFO

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
const val SEVERITY_INFO = 1: Int
```

## Public functions

### builder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
java-static fun builder(): KeyedAppState.KeyedAppStateBuilder
```

Create a `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState.KeyedAppStateBuilder`.

### getData

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
abstract fun getData(): String?
```

Optionally, a machine-readable value to be read by the EMM. For example, setting values that the admin can choose to query against in the EMM console (e.g. "notify me if the battery_warning data \<10").

### getKey

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
abstract fun getKey(): String
```

The key for the app state. Acts as a point of reference for what the app is providing state for. For example, when providing managed configuration feedback, this key could be the managed configuration key to allow EMMs to take advantage of the connection in their UI.

### getMaxDataLength

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.1.0)

```
java-static fun getMaxDataLength(): Int
```

Get the maximum length of `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getData()`.

### getMaxKeyLength

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.1.0)

```
java-static fun getMaxKeyLength(): Int
```

Get the maximum length of `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getKey()`.

### getMaxMessageLength

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.1.0)

```
java-static fun getMaxMessageLength(): Int
```

Get the maximum length of `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#getMessage()`.

### getMessage

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
abstract fun getMessage(): String?
```

Optionally, a free-form message string to explain the app state. If the state was triggered by a particular value (e.g. a managed configuration value), it should be included in the message.

### getSeverity

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/enterprise#1.0.0)

```
abstract fun getSeverity(): Int
```

The severity of the app state. This allows EMMs to choose to notify admins of errors. This should only be set to `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#SEVERITY_ERROR()` for genuine error conditions that a management organization needs to take action to fix.

When sending an app state containing errors, it is critical that follow-up app states are sent when the errors have been resolved, using the same key and this value set to `https://developer.android.com/reference/kotlin/androidx/enterprise/feedback/KeyedAppState#SEVERITY_INFO()`.