Fix group switching: send selectGroup on background thread
This commit is contained in:
@@ -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() {
|
||||||
|
|||||||
@@ -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}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user