2015-04-01 66 views
2

在我的應用程序中,我使用setCharacteristicNotification爲特徵啓用了notificaito。在日誌貓我得到通知啓用true也獲得onDescriptorWrite回調成功,但回調方法onCharacteristicChanged不叫。請幫助我。在此先感謝未啓用Android BLE onCharacteristicChanged

日誌

D/BluetoothGatt(15694): setCharacteristicNotification() - uuid: 00003c01-0000-1000-8000-00805f9b34fb enable: true 

代碼

mBluetoothGatt.setCharacteristicNotification(characteristic, enabled); 

      BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
        UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG)); 
      descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); 
      return mBluetoothGatt.writeDescriptor(descriptor); 
+0

請幫幫我。我困在這個問題上。 – user1767260 2015-04-02 06:09:46

+0

有些想法可以幫助你。檢查藍牙設備內部的藍牙配置文件實現,它使用「通知」或「指示」發佈更新。還有一些設備具有控制描述符和特定字節來激活通知流程,也許文檔有一些關於它的內容。 – 2015-04-07 08:52:40

回答

0

的讀寫操作,現在是工作的罰款之間就增加睡眠。

try { 
        Thread.sleep(200); 
       } catch (InterruptedException e) { 
        e.printStackTrace(); 
       } 
+0

我也面臨同樣的問題,你能幫我嗎 - 我應該在哪裏補充睡眠? – 2016-12-01 08:04:51