Beispiel für Bluetooth -Chat Android Client

Thread {
                val bluetoothSocket = device.device.createRfcommSocketToServiceRecord(uuid)
                bluetoothAdapter?.cancelDiscovery()
                val succeeded = try {
                    bluetoothSocket?.connect()
                    device.socket = bluetoothSocket
                    true
                } catch (e: Exception) {
                    e.printStackTrace()
                    false
                }
                Handler(Looper.getMainLooper()).post {
                    onFinished.invoke(succeeded)
                }
            }.start()
Real Raven