Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

KeyedAppStatesReporter

public class KeyedAppStatesReporter
extends Object

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


A reporter of keyed app states to enable communication between an app and an EMM (enterprise mobility management).

Summary

Constants

String APP_STATES_ACTION

The intent action for reporting app states.

Public methods

static KeyedAppStatesReporter getInstance(Context context)

Returns an instance of the reporter.

static void initialize(Context context, Executor executor)

Sets executor used to construct the singleton.

void set(Collection<KeyedAppState> states)

Set app states to be sent to an EMM (enterprise mobility management).

void setImmediate(Collection<KeyedAppState> states)

Performs the same function as set(Collection), except it also requests that the states are immediately uploaded to be accessible via server APIs.

Inherited methods

Constants

APP_STATES_ACTION

public static final String APP_STATES_ACTION

The intent action for reporting app states.

Constant Value: "androidx.enterprise.feedback.action.APP_STATES"

Public methods

getInstance

public static KeyedAppStatesReporter getInstance (Context context)

Returns an instance of the reporter.

Creates and initializes an instance if one doesn't already exist.

Parameters
context Context

Returns
KeyedAppStatesReporter

initialize

public static void initialize (Context context, 
                Executor executor)

Sets executor used to construct the singleton.

If required, this method must be called before calling getInstance(Context).

If this method is not called, the reporter will run on a newly-created thread. This newly-created thread will be cleaned up and recreated as necessary when idle.

Parameters
context Context

executor Executor

set

public void set (Collection<KeyedAppState> states)

Set app states to be sent to an EMM (enterprise mobility management). The EMM can then display this information to the management organization.

Do not send personally-identifiable information with this method.

Each provided keyed app state will replace any previously set keyed app states with the same key for this package name.

If multiple keyed app states are set with the same key, only one will be received by the EMM. Which will be received is not defined.

This information is sent immediately to all device owner and profile owner apps on the device. It is also sent immediately to the app with package name com.android.vending if it exists, which is the Play Store on GMS devices.

EMMs can access these states either directly in a custom DPC (device policy manager), via Android Management APIs, or via Play EMM APIs.

Parameters
states Collection

setImmediate

public void setImmediate (Collection<KeyedAppState> states)

Performs the same function as set(Collection), except it also requests that the states are immediately uploaded to be accessible via server APIs.

The receiver is not obligated to meet this immediate upload request. For example, Play and Android Management APIs have daily quotas.

Parameters
states Collection