/BluetoothClassic_MVVM

Bluetooth Classic Android App(MVVM), Arduino SPP

Primary LanguageKotlin

BluetoothClassic_MVVM

Bluetooth Classic Android App(MVVM), Arduino SPP

Info

  • If you want to see your bluetooth device like this code preview, modify mBluetoothStateReceiver code in registerBluetoothReceiver(), Repository.kt
BluetoothDevice.ACTION_FOUND -> {
     if (!foundDevice) {
         val device_name = device!!.name
         val device_Address = device.address
                            
          // It only searches for devices with the prefix "RNM" in the Bluetooth device name.
           if (device_name != null && device_name.length > 4) {
                if (device_name.substring(0, 3) == "RNM") {
                        // filter your targetDevice and use connectToTargetedDevice()
                        targetDevice = device
                        foundDevice = true
                        connectToTargetedDevice(targetDevice)
                     }
                }        
           }
     }

Preview

Device Connect

connect

Android Data Receive&Send

androiddata

Arduino Data Receive&Send

arduinodata

Blog