Android Studio Bluetooth с низким энергопотреблением Bluno Basic Demo Crash на API 25

Привет! Я пытаюсь реализовать Bluno Basic Demo для DFRobot по этой ссылке https://github.com/DFRobot/BlunoBasicDemo и это работает, но я пытаюсь адаптироваться к API 25, и первое, что нам нужно активировать разрешения времени выполнения следующим образом:

    if (ActivityCompat.checkSelfPermission(this,
        Manifest.permission.ACCESS_FINE_LOCATION)
        != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,
        Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
    ActivityCompat.requestPermissions(this,
            new String[]{Manifest.permission.ACCESS_FINE_LOCATION,}, 1000);
}

    else {
        buttonScanOnClickProcess();                                        //Alert Dialog for selecting the BLE device
    }

Это тоже работает, и приложение уже находит мой Bluno (BLE), но когда я пытаюсь подключиться к устройству, приложение вылетает и показывает следующий журнал.

I/System.out: ACTION_GATT_SERVICES_DISCOVERED  00001801-0000-1000-8000-00805f9b34fb
I/System.out: ACTION_GATT_SERVICES_DISCOVERED  0000180a-0000-1000-8000-00805f9b34fb
I/System.out: ACTION_GATT_SERVICES_DISCOVERED  0000dfb0-0000-1000-8000-00805f9b34fb
I/System.out: displayGattServices + uuid=00001800-0000-1000-8000-00805f9b34fb
I/System.out: displayGattServices + uuid=00001801-0000-1000-8000-00805f9b34fb
I/System.out: displayGattServices + uuid=0000180a-0000-1000-8000-00805f9b34fb
I/System.out: mModelNumberCharacteristic  00002a24-0000-1000-8000-00805f9b34fb
I/System.out: displayGattServices + uuid=0000dfb0-0000-1000-8000-00805f9b34fb
I/System.out: mSerialPortCharacteristic  0000dfb1-0000-1000-8000-00805f9b34fb
I/System.out: mSerialPortCharacteristic  0000dfb1-0000-1000-8000-00805f9b34fb
I/System.out: onCharacteristicRead  00002a24-0000-1000-8000-00805f9b34fb
I/System.out: BluetoothLeService broadcastUpdate
I/SendBroadcastPermission: action:com.example.bluetooth.le.ACTION_DATA_AVAILABLE, mPermissionType:0
I/System.out: mGattUpdateReceiver->onReceive->action=com.example.bluetooth.le.ACTION_DATA_AVAILABLE
I/System.out: allwriteCharacteristicString:AT+PASSWOR=DFRobot
I/System.out: mCharacteristicRingBufferlength:1
I/System.out: writeCharacteristic init AT+PASSWOR=DFRobo:success
I/System.out: onCharacteristicWrite success:AT+PASSWOR=DFRobo
I/System.out: allwriteCharacteristicString:AT+CURRUART=115200
I/System.out: mCharacteristicRingBufferlength:2
I/System.out: writeCharacteristic init t
I/System.out: :success
I/System.out: onCharacteristicWrite success:t
I/System.out: writeCharacteristic init AT+CURRUART=11520:success
I/System.out: displayData 1
I/System.out: onCharacteristicWrite success:AT+CURRUART=11520
I/System.out: writeCharacteristic init 0
I/System.out: :success
I/System.out: onCharacteristicWrite success:0
I/System.out: onCharacteristicChanged  150
I/System.out: BluetoothLeService broadcastUpdate
I/SendBroadcastPermission: action:com.example.bluetooth.le.ACTION_DATA_AVAILABLE, mPermissionType:0
I/System.out: mGattUpdateReceiver->onReceive->action=com.example.bluetooth.le.ACTION_DATA_AVAILABLE
I/Process: Sending signal. PID: 21810 SIG: 9

Можете ли вы помочь мне решить эту проблему?

Заранее спасибо.

0 ответов

Другие вопросы по тегам