ServiceListenerHelper

class ServiceListenerHelper : Service.Listener

DSL builder for Service.Listener that allows setting callbacks for starting, running, stopping, terminated, and failed lifecycle events.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun failed(block: (Service.State, Throwable) -> Unit)

Sets the callback invoked when the service has failed.

open override fun failed(from: Service.State, failure: Throwable)
Link copied to clipboard
open override fun running()

fun running(block: () -> Unit)

Sets the callback invoked when the service enters the running state.

Link copied to clipboard
open override fun starting()

fun starting(block: () -> Unit?)

Sets the callback invoked when the service is starting.

Link copied to clipboard
open override fun stopping(from: Service.State)

fun stopping(block: (Service.State) -> Unit)

Sets the callback invoked when the service is stopping.

Link copied to clipboard
open override fun terminated(from: Service.State)

fun terminated(block: (Service.State) -> Unit)

Sets the callback invoked when the service has terminated.