bindService
fun bindService(context: Context, serviceClass: Class<out StreamerService<*>>, onServiceCreated: (IStreamer) -> Unit, onServiceDisconnected: (name: ComponentName?) -> Unit = {}, onExtra: (Intent) -> Unit = {}): ServiceConnection
Starts and binds the service with the appropriate parameters.
Return
the service connection. Use it to Context.unbindService when you don't need the service anymore.
Parameters
context
the application context.
serviceClass
the service class to launch. It is a children of StreamerService.
onServiceCreated
the callback that returns a children of StreamerService instance when the service has been connected.
onServiceDisconnected
the callback that will be called when the service is disconnected.
onExtra
the callback that will be called to pass the extra bundle to the service.
fun bindService(context: Context, serviceClass: Class<out StreamerService<*>>, connection: ServiceConnection, onExtra: (Intent) -> Unit = {})
Starts and binds the service with the appropriate parameters.
Parameters
context
the application context.
serviceClass
the service class to launch. It is a children of StreamerService.
connection
the service connection.
onExtra
the callback that will be called to pass the extra bundle to the service.