fix background connections, add manual force connection button

This commit is contained in:
Kavish Devar
2024-12-06 11:56:07 +05:30
parent 0c1f9464ad
commit 2679205dc3
8 changed files with 597 additions and 537 deletions
@@ -70,6 +70,22 @@ class MainActivity : ComponentActivity() {
}
super.onDestroy()
}
override fun onStop() {
try {
unbindService(serviceConnection)
Log.d("MainActivity", "Unbound service")
} catch (e: Exception) {
Log.e("MainActivity", "Error while unbinding service: $e")
}
try {
unregisterReceiver(connectionStatusReceiver)
Log.d("MainActivity", "Unregistered receiver")
} catch (e: Exception) {
Log.e("MainActivity", "Error while unregistering receiver: $e")
}
super.onStop()
}
}
@SuppressLint("MissingPermission", "InlinedApi")
@@ -86,7 +102,6 @@ fun Main() {
val airPodsService = remember { mutableStateOf<AirPodsService?>(null) }
if (permissionState.allPermissionsGranted) {
Log.d("MainActivity", "HIIIIIIIIIIIIIII")
val context = LocalContext.current
val navController = rememberNavController()