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
要添加到此设备提供的服务列表中的服务。
返回
如果已启动添加服务的请求,则为 true
- 特性
注解
将服务添加到要托管的服务列表中。
将服务添加到列表中后,该服务及其包含的特征将由本地设备提供。
如果调用此函数时本地设备已公开服务,则会向所有客户端发送服务更新通知。
回调 BluetoothGattServerCallback#onServiceAdded 将指示是否已成功添加此服务。 不要在此回调之前添加另一个服务。
Java文档android.bluetooth.BluetoothGattServer.addService(android.bluetooth.BluetoothGattService)。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。