ServiceLifecycleObserver

Observer for Service lifecycle events.

Use this interface to track lifecycle changes of SDK Services.

ServiceLifecycleObserver API

onServiceCreated

void onServiceCreated(Class<? extends Service> cls)

Called when a Service used by the SDK is created. cls is the Service class that was created.

onServiceDestroyed

void onServiceDestroyed(Class<? extends Service> cls)

Called when a Service used by the SDK is destroyed. cls is the Service class that was destroyed.

onForegroundStarted

void onForegroundStarted(Class<? extends Service> cls)

Called when a Service used by the SDK starts running in the foreground. cls is the Service class that started foreground execution.

onForegroundStopped

void onForegroundStopped(Class<? extends Service> cls)

Called when a Service used by the SDK stops running in the foreground. cls is the Service class that stopped foreground execution.

Threading

Observer callbacks are posted on the main thread.

Example

Last updated