stackoverflow 上的Android BLE API: GATT Notification not received一点感想

博客探讨了在Android应用中使用BLE API时遇到的GATT通知未接收的问题。作者引用了Stack Overflow上的讨论,指出`writeDescriptor`接口仅在本地设置而不会直接更新远程设备。解决这个问题需要理解蓝牙核心规范并手动重写descriptor,这一细节在Google的API文档中并未明确提及,对不熟悉蓝牙开发的程序员来说是个潜在陷阱。
摘要由CSDN通过智能技术生成

大家可以先看一下starkoverflow的一个讨论(时间是两年前的):

http://stackoverflow.com/questions/17910322/android-ble-api-gatt-notification-not-received


大致内容就是安卓上的app明显调用了

public boolean setCharacteristicNotification (BluetoothGattCharacteristic characteristic, boolean enable)

的接口,却收不到gatt server发过来的notification。

让我们先看看这个接口的解释:

Enable or disable notifications/indications for a given characteristic.

Once notifications are enabled for a characteristic, a onCharacteristicChanged(BluetoothGatt, BluetoothGattCharacteristic) callback will be triggered if the remote device indicates that the given characteristic has changed.

Requires BLUETOOTH permission.

Parameters
characteristic	The characteristic for which to enable notifications
enable	Set to true to enable notifications/indications
Returns
true, if the requested notif
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值