mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +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
|
recorderService?.amplitudesAmount = amount
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
fun bindToService(context: Context) {
|
||||||
fun BindToService(context: Context) {
|
|
||||||
LaunchedEffect(Unit) {
|
|
||||||
Intent(context, AudioRecorderService::class.java).also { intent ->
|
Intent(context, AudioRecorderService::class.java).also { intent ->
|
||||||
context.bindService(intent, connection, 0)
|
context.bindService(intent, connection, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun unbindFromService(context: Context) {
|
||||||
|
runCatching {
|
||||||
|
context.unbindService(connection)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user