KeyedAppStatesService
abstract class KeyedAppStatesService : Service
| kotlin.Any | ||||
| ↳ | android.content.Context | |||
| ↳ | android.content.ContextWrapper | |||
| ↳ | android.app.Service | |||
| ↳ | androidx.enterprise.feedback.KeyedAppStatesService | |||
Base service for receiving app states in Device Owner and Profile Owner apps.
Extend this class and declare it as a service in the manifest. For example, if your service is called 'MyAppStatesService', including the following in the manifest:
<service android:name=".MyAppStatesService">
<intent-filter>
<action android:name="androidx.enterprise.feedback.action.APP_STATES" />
</intent-filter>
</service>
Override onReceive(Collection, boolean) to receive keyed app states. is invoked on a background thread.
Summary
| Public constructors | |
|---|---|
<init>()Base service for receiving app states in Device Owner and Profile Owner apps. |
|
| Public methods | |
|---|---|
| open IBinder | |
| abstract Unit |
onReceive(@NonNull states: MutableCollection<ReceivedKeyedAppState!>, requestSync: Boolean)Called when an app sends states. |
Public constructors
<init>
KeyedAppStatesService()
Base service for receiving app states in Device Owner and Profile Owner apps.
Extend this class and declare it as a service in the manifest. For example, if your service is called 'MyAppStatesService', including the following in the manifest:
<service android:name=".MyAppStatesService">
<intent-filter>
<action android:name="androidx.enterprise.feedback.action.APP_STATES" />
</intent-filter>
</service>
Override onReceive(Collection, boolean) to receive keyed app states. is invoked on a background thread.
Public methods
onReceive
abstract fun onReceive(
@NonNull states: MutableCollection<ReceivedKeyedAppState!>,
requestSync: Boolean
): Unit
Called when an app sends states. States are key/value, so new values should replace existing ones for the same key.
| Parameters | |
|---|---|
states |
MutableCollection<ReceivedKeyedAppState!>: The states sent by an app. Every state will have the same packageName and timestamp. |
requestSync |
Boolean: true if the app requests an immediate upload for access by server APIs. This immediate upload request does not have to be respected if a quota that you have defined has been exceeded. |

