다음을 통해 공유


BluetoothGattServer.AddService(BluetoothGattService) Method

Definition

Add a service to the list of services to be hosted.

[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

Parameters

service
BluetoothGattService

Service to be added to the list of services provided by this device.

Returns

true, if the request to add service has been initiated

Attributes

Remarks

Add a service to the list of services to be hosted.

Once a service has been added to the list, the service and its included characteristics will be provided by the local device.

If the local device has already exposed services when this function is called, a service update notification will be sent to all clients.

The BluetoothGattServerCallback#onServiceAdded callback will indicate whether this service has been added successfully. Do not add another service before this callback.

Java documentation for android.bluetooth.BluetoothGattServer.addService(android.bluetooth.BluetoothGattService).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to