KeyedAppStatesReporter
public
abstract
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).
For production, create an instance using create(Context)
.
For testing see the FakeKeyedAppStatesReporter
class in
the enterprise-feedback-testing
artifact.
Summary
Public methods | |
---|---|
static
KeyedAppStatesReporter
|
create(Context context)
Create a reporter that binds to device owners, profile owners, and the Play store. |
static
KeyedAppStatesReporter
|
create(Context context, Executor executor)
Create a reporter using the specified executor. |
void
|
setStates(Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
Set app states to be sent to an EMM (enterprise mobility management). |
abstract
void
|
setStates(Collection<KeyedAppState> states)
This method is deprecated.
use |
abstract
void
|
setStatesImmediate(Collection<KeyedAppState> states)
This method is deprecated.
use |
void
|
setStatesImmediate(Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
Performs the same function as |
Inherited methods | |
---|---|
Public methods
create
public static KeyedAppStatesReporter create (Context context)
Create a reporter that binds to device owners, profile owners, and the Play store.
Each instance maintains bindings, so it's recommended that you maintain a single instance for your whole app, rather than creating instances as needed.
Parameters | |
---|---|
context |
Context |
Returns | |
---|---|
KeyedAppStatesReporter |
create
public static KeyedAppStatesReporter create (Context context, Executor executor)
Create a reporter using the specified executor.
Each instance maintains bindings, so it's recommended that you maintain a single instance for your whole app, rather than creating instances as needed.
The executor must run all Runnable
instances on the same thread, serially.
Parameters | |
---|---|
context |
Context |
executor |
Executor |
Returns | |
---|---|
KeyedAppStatesReporter |
setStates
public void setStates (Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
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.
KeyedAppStatesCallback.onResult(int, Throwable)
will be called when an
error occurs.
Parameters | |
---|---|
states |
Collection |
callback |
KeyedAppStatesCallback |
setStates
public abstract void setStates (Collection<KeyedAppState> states)
This method is deprecated.
use setStates(Collection, KeyedAppStatesCallback)
which reports
errors.
Parameters | |
---|---|
states |
Collection |
setStatesImmediate
public abstract void setStatesImmediate (Collection<KeyedAppState> states)
This method is deprecated.
use setStatesImmediate(Collection, KeyedAppStatesCallback)
which
reports errors.
Parameters | |
---|---|
states |
Collection |
setStatesImmediate
public void setStatesImmediate (Collection<KeyedAppState> states, KeyedAppStatesCallback callback)
Performs the same function as setStates(Collection, KeyedAppStatesCallback)
,
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.
KeyedAppStatesCallback.onResult(int, Throwable)
will be called
when an error occurs.
Parameters | |
---|---|
states |
Collection |
callback |
KeyedAppStatesCallback |