BluetoothGatt.SetCharacteristicNotification 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
启用或禁用给定特征的通知/指示。
[Android.Runtime.Register("setCharacteristicNotification", "(Landroid/bluetooth/BluetoothGattCharacteristic;Z)Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool SetCharacteristicNotification(Android.Bluetooth.BluetoothGattCharacteristic? characteristic, bool enable);
[<Android.Runtime.Register("setCharacteristicNotification", "(Landroid/bluetooth/BluetoothGattCharacteristic;Z)Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.SetCharacteristicNotification : Android.Bluetooth.BluetoothGattCharacteristic * bool -> bool
参数
- characteristic
- BluetoothGattCharacteristic
要为其启用通知的特征
- enable
- Boolean
设置为 true 以启用通知/指示
返回
如果已成功设置请求的通知状态,则为 true
- 特性
注解
启用或禁用给定特征的通知/指示。
为特征启用通知后,如果远程设备指示给定的特征已更改, BluetoothGattCallback#onCharacteristicChanged(BluetoothGatt, BluetoothGattCharacteristic, byte[]) 将触发回调。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。