bindService
fun bindService(context: Context, serviceClass: Class<out MediaProjectionService<*>>, resultCode: Int, resultData: Intent, 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 MediaProjectionService.
resultCode
the result code of the ActivityResult
resultData
the result data of the ActivityResult
onServiceCreated
the callback that returns a children of MediaProjectionService 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