Lingua

BluetoothDevice.FetchUuids(Int32) Method

Definition

Performs a service discovery on the remote device to get the UUIDs supported, allowing the caller to specify the transport.

[Android.Runtime.Register("fetchUuids", "(I)Z", "", ApiSince=37)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool FetchUuids(int transport);
[<Android.Runtime.Register("fetchUuids", "(I)Z", "", ApiSince=37)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.FetchUuids : int -> bool

Parameters

transport
Int32

The transport to use for discovery: #TRANSPORT_BREDR for Classic Bluetooth (SDP), #TRANSPORT_LE for Bluetooth Low Energy (GATT), or #TRANSPORT_AUTO to discover on all applicable transports (typically BR/EDR and LE for dual-mode devices). *

Returns

False if the check fails, True if the process of initiating an ACL connection to the remote device was started or cached UUIDs will be broadcast with the specific transport.

Attributes

Remarks

Performs a service discovery on the remote device to get the UUIDs supported, allowing the caller to specify the transport.

This API is asynchronous. When discovery completes, the ACTION_UUID intent is sent, containing the UUIDs supported by the remote device for the specified transport(s). Cached UUIDs may be sent if an error occurs or if discovery is lengthy. Use getUuids() to retrieve cached UUIDs without initiating discovery.

The implementation already handles invalid transport arguments by throwing IllegalArgumentException and returns false when Bluetooth is disabled, covering the contract verification points. For apps targeting Build.VERSION_CODES.S or or higher, this requires the Manifest.permission.BLUETOOTH_CONNECT permission which can be gained with android.app.Activity.requestPermissions(String[],int). Requires Manifest.permission.BLUETOOTH_CONNECT

Android reference for android.bluetooth.BluetoothDevice.fetchUuids.

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