fix: ensure bg loc permissions, unbind service (#2050)

This commit is contained in:
James Rich 2025-06-07 20:42:29 +00:00 committed by GitHub
parent d8e9c30399
commit 89462be97a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 0 deletions

View file

@ -389,6 +389,25 @@ class MainActivity : AppCompatActivity(), Logging {
)
}
private fun unbindMeshService() {
// If we have received the service, and hence registered with
// it, then now is the time to unregister.
// if we never connected, do nothing
debug("Unbinding from mesh service!")
connectionJob?.let { job ->
connectionJob = null
warn("We had a pending onConnection job, so we are cancelling it")
job.cancel("unbinding")
}
mesh.close()
serviceRepository.setMeshService(null)
}
override fun onStop() {
unbindMeshService()
super.onStop()
}
override fun onStart() {
super.onStart()
bluetoothViewModel.enabled.observe(this) { enabled ->