顯示具有 BlueTooth 標籤的文章。 顯示所有文章
顯示具有 BlueTooth 標籤的文章。 顯示所有文章

2019年1月15日 星期二

[Android] BLE Gatt error 133 (solved)

BLE disconnect. Gatt error 133

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

            connectDevice.connectGatt(context, Consts.autoConnect, gatt_callback, BluetoothDevice.TRANSPORT_LE);
}else {

            connectDevice.connectGatt(context, Consts.autoConnect, gatt_callback);
}

2013年6月14日 星期五

[Android] Bluetooth Chat receive data lost

原先: 
while (true) {
                try {
                    // Read from the InputStream
                    bytes = mmInStream.read(buffer);
                    // Send the obtained bytes to the UI Activity
                    mHandler.obtainMessage(BluetoothChat.MESSAGE_READ, bytes, -1, buffer)
                            .sendToTarget();
                } catch (IOException e) {
                    Log.e(TAG, "disconnected", e);
                    connectionLost();
                    // Start the service over to restart listening mode
                    BluetoothChatService.this.start();
                    break;
                }
            }