Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

KeyedAppState

public abstract class KeyedAppState
extends Object

java.lang.Object
   ↳ androidx.enterprise.feedback.KeyedAppState


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 classes

class KeyedAppState.KeyedAppStateBuilder

The builder for KeyedAppState

Constants

int MAX_DATA_LENGTH

The maximum length of the data field.

int MAX_KEY_LENGTH

The maximum length of the key.

int MAX_MESSAGE_LENGTH

The maximum length of the message field.

int SEVERITY_ERROR

int SEVERITY_INFO

Public methods

static KeyedAppState.KeyedAppStateBuilder builder()

Create a KeyedAppState.KeyedAppStateBuilder.

abstract String getData()

Optionally, a machine-readable value to be read by the EMM.

abstract String getKey()

The key for the app state.

abstract String getMessage()

Optionally, a free-form message string to explain the app state.

abstract int getSeverity()

The severity of the app state.

Inherited methods

Constants

MAX_DATA_LENGTH

public static final int MAX_DATA_LENGTH

The maximum length of the data field.

Constant Value: 1000 (0x000003e8)

MAX_KEY_LENGTH

public static final int MAX_KEY_LENGTH

The maximum length of the key.

Constant Value: 100 (0x00000064)

MAX_MESSAGE_LENGTH

public static final int MAX_MESSAGE_LENGTH

The maximum length of the message field.

Constant Value: 1000 (0x000003e8)

SEVERITY_ERROR

public static final int SEVERITY_ERROR

Constant Value: 2 (0x00000002)

SEVERITY_INFO

public static final int SEVERITY_INFO

Constant Value: 1 (0x00000001)

Public methods

getData

public abstract String getData ()

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”).

Returns
String

getKey

public abstract String getKey ()

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.

Returns
String

getMessage

public abstract String getMessage ()

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.

Returns
String

getSeverity

public abstract int getSeverity ()

The severity of the app state. This allows EMMs to choose to notify admins of errors. This should only be set to 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 SEVERITY_INFO.

Returns
int