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

KeyedAppStatesService

public abstract class KeyedAppStatesService
extends Service

java.lang.Object
   ↳ 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. onReceive(Collection, boolean) is invoked on a background thread.

Summary

Inherited constants

Public constructors

KeyedAppStatesService()

Public methods

IBinder onBind(Intent intent)
abstract void onReceive(Collection<ReceivedKeyedAppState> states, boolean requestSync)

Called when an app sends states.

Inherited methods

Public constructors

KeyedAppStatesService

public KeyedAppStatesService ()

Public methods

onBind

public IBinder onBind (Intent intent)

Parameters
intent Intent

Returns
IBinder

onReceive

public abstract void onReceive (Collection<ReceivedKeyedAppState> states, 
                boolean requestSync)

Called when an app sends states. States are key/value, so new values should replace existing ones for the same key.

Parameters
states Collection: The states sent by an app. Every state will have the same ReceivedKeyedAppState.packageName() and ReceivedKeyedAppState.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.