Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

bluetooth chat example 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()
Source by davidadeyyinka.medium.com #
 
PREVIOUS NEXT
Tagged: #bluetooth #chat #android #client
ADD COMMENT
Topic
Name
3+8 =