mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
fix: Unbind from service on dispose
This commit is contained in:
parent
d87c7a182e
commit
fead95f1fc
@ -120,12 +120,15 @@ class AudioRecorderModel: ViewModel() {
|
||||
recorderService?.amplitudesAmount = amount
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BindToService(context: Context) {
|
||||
LaunchedEffect(Unit) {
|
||||
Intent(context, AudioRecorderService::class.java).also { intent ->
|
||||
context.bindService(intent, connection, 0)
|
||||
}
|
||||
fun bindToService(context: Context) {
|
||||
Intent(context, AudioRecorderService::class.java).also { intent ->
|
||||
context.bindService(intent, connection, 0)
|
||||
}
|
||||
}
|
||||
|
||||
fun unbindFromService(context: Context) {
|
||||
runCatching {
|
||||
context.unbindService(connection)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user