Fix group switching: send selectGroup on background thread

This commit is contained in:
ua1zbe
2026-08-17 11:11:30 +03:00
parent eeffc14f1a
commit 3109c52bbd
2 changed files with 4 additions and 2 deletions

View File

@@ -89,7 +89,8 @@ class SvxService : Service(), ReflectorClient.Callbacks {
fun isRunning(): Boolean = client.isRunning() fun isRunning(): Boolean = client.isRunning()
fun selectGroup(tg: Long) { fun selectGroup(tg: Long) {
client.selectGroup(tg) // Сеть запрещена в главном потоке (NetworkOnMainThreadException)
Thread { client.selectGroup(tg) }.start()
} }
fun startTx() { fun startTx() {

View File

@@ -171,7 +171,8 @@ class ReflectorClient(
try { try {
Log.d(TAG, "selectGroup tg=$tg") Log.d(TAG, "selectGroup tg=$tg")
sendTcp(sock, MsgBuilder.selectTg(tg)) sendTcp(sock, MsgBuilder.selectTg(tg))
} catch (_: Exception) { } catch (e: Exception) {
Log.w(TAG, "selectGroup send failed: ${e.javaClass.simpleName}: ${e.message}")
} }
} }