語言

BluetoothGatt.SetCharacteristicNotification 方法

定義

啟用或停用特定特徵的通知/指示。

[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[]) 若遠端裝置表示該特徵已變更,則會觸發回撥。

Java 文件 android.bluetooth.BluetoothGatt.setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於