Fixed crash if BluetoothAdapter.STATE_ON
is received twice.
This commit is contained in:
parent
3f19e86c75
commit
b1bb4eb8b3
1 changed files with 2 additions and 1 deletions
|
@ -143,7 +143,8 @@ class BluetoothInterface(context: Context, mainHandler: Handler,
|
|||
override def onReceive(context: Context, intent: Intent): Unit = {
|
||||
intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1) match {
|
||||
case BluetoothAdapter.STATE_ON =>
|
||||
startBluetoothConnections()
|
||||
if (!listenThread.isAlive)
|
||||
startBluetoothConnections()
|
||||
case BluetoothAdapter.STATE_TURNING_OFF =>
|
||||
Log.i(Tag, "Bluetooth disabled, stopping connectivity")
|
||||
listenThread.cancel()
|
||||
|
|
Reference in a new issue