簡單的描述下分享給大家個demo:
網上找了一大堆,剛開始配對是沒問題的,但是斷開連接和連接設備就出現很多報錯,用的是
BluetoothSocket.connect,發現完全不是同一個方向,一直報錯getBluetoothService() called with no BluetoothManagerCallback 或
read failed, socket might closed or timeout, read ret: -1。
連接和斷開的藍牙關鍵類應該是 BluetoothProfile。
demo鏈接://download.csdn.net/download/Roshen_android/12194995