BluetoothGattServer.AddService(BluetoothGattService) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將一項服務加入待主機服務清單。
[Android.Runtime.Register("addService", "(Landroid/bluetooth/BluetoothGattService;)Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool AddService(Android.Bluetooth.BluetoothGattService? service);
[<Android.Runtime.Register("addService", "(Landroid/bluetooth/BluetoothGattService;)Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.AddService : Android.Bluetooth.BluetoothGattService -> bool
參數
- service
- BluetoothGattService
服務將加入此裝置提供的服務清單中。
傳回
如果新增服務的請求已經啟動,則為真
- 屬性
備註
將一項服務加入待主機服務清單。
一旦服務加入清單,該服務及其包含的特性將由本地裝置提供。
如果本地裝置在呼叫此功能時已經暴露了服務,將會向所有用戶端發送服務更新通知。
BluetoothGattServerCallback#onServiceAdded回撥時會顯示該服務是否已成功新增。 在回電前請勿新增其他服務。
Java 文件 android.bluetooth.BluetoothGattServer.addService(android.bluetooth.BluetoothGattService)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。