services-api / com.keecker.services.interfaces / KeeckerServiceConnection / onNewServiceInstance

onNewServiceInstance

fun onNewServiceInstance(lambda: suspend (ServiceInterface) -> Unit): Unit

Overrides PersistentServiceConnection.onNewServiceInstance

  • Notifies when binding to a new Service instance. May it be because it is the first time we connect to it, or because it crashed.
  • Does not notify when unbinding then rebinding to the same Service instance
  • Called before exectuting any AIDL call that is triggered the bind
  • Typically used to get the service to its expected state, like resubscribing to some data after a crash.