Android Guides | Samples

Android.Bluetooth.BluetoothDevice Class

Represents a remote Bluetooth device.

See Also: BluetoothDevice

Syntax

[Android.Runtime.Register("android/bluetooth/BluetoothDevice", DoNotGenerateAcw=true)]
public sealed class BluetoothDevice : Object, IParcelable, IDisposable

Remarks

Represents a remote Bluetooth device. A BluetoothDevice lets you create a connection with the respective device or query information about it, such as the name, address, class, and bonding state.

This class is really just a thin wrapper for a Bluetooth hardware address. Objects of this class are immutable. Operations on this class are performed on the remote Bluetooth hardware address, using the BluetoothAdapter that was used to create this BluetoothDevice.

To get a BluetoothDevice, use BluetoothAdapter.GetRemoteDevice(String) to create one representing a device of a known MAC address (which you can get through device discovery with BluetoothAdapter) or get one from the set of bonded devices returned by BluetoothAdapter.BondedDevices. You can then open a BluetoothSocket for communication with the remote device, using BluetoothDevice.CreateRfcommSocketToServiceRecord(UUID).

Note: Requires the NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#BLUETOOTH permission.

Developer Guides

For more information about using Bluetooth, read the Bluetooth developer guide.

See Also

[Android Documentation]

Requirements

Namespace: Android.Bluetooth
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 5

The members of Android.Bluetooth.BluetoothDevice are listed below.

See Also: Object

Public Fields

const
ActionAclConnectedString. Broadcast Action: Indicates a low level (ACL) connection has been established with a remote device.
const
ActionAclDisconnectedString. Broadcast Action: Indicates a low level (ACL) disconnection from a remote device.
const
ActionAclDisconnectRequestedString. Broadcast Action: Indicates that a low level (ACL) disconnection has been requested for a remote device, and it will soon be disconnected.
const
ActionBondStateChangedString. Broadcast Action: Indicates a change in the bond state of a remote device.
const
ActionClassChangedString. Broadcast Action: Bluetooth class of a remote device has changed.
const
ActionFoundString. Broadcast Action: Remote device discovered.
const
ActionNameChangedString. Broadcast Action: Indicates the friendly name of a remote device has been retrieved for the first time, or changed since the last retrieval.
const
ActionPairingRequestString. Broadcast Action: This intent is used to broadcast PAIRING REQUEST
const
ActionUuidString. Broadcast Action: This intent is used to broadcast the UUID wrapped as a ParcelUuid of the remote device after it has been fetched.
const
DeviceTypeClassicBluetoothDeviceType (1). Bluetooth device type, Classic - BR/EDR devices
const
DeviceTypeDualBluetoothDeviceType (3). Bluetooth device type, Dual Mode - BR/EDR/LE
const
DeviceTypeLeBluetoothDeviceType (2). Bluetooth device type, Low Energy - LE-only
const
DeviceTypeUnknownBluetoothDeviceType (0). Bluetooth device type, Unknown
const
ErrorInt32 (-2147483648). Sentinel error value for this class.
const
ExtraBondStateString. Used as an int extra field in BluetoothDevice.ActionBondStateChanged intents.
const
ExtraClassString. Used as a Parcelable BluetoothClass extra field in BluetoothDevice.ActionFound and BluetoothDevice.ActionClassChanged intents.
const
ExtraDeviceString. Used as a Parcelable BluetoothDevice extra field in every intent broadcast by this class.
const
ExtraNameString. Used as a String extra field in BluetoothDevice.ActionNameChanged and BluetoothDevice.ActionFound intents.
const
ExtraPairingKeyString. Used as an int extra field in BluetoothDevice.ActionPairingRequest intents as the value of passkey.
const
ExtraPairingVariantString. Used as an int extra field in BluetoothDevice.ActionPairingRequest intents to indicate pairing method used.
const
ExtraPreviousBondStateString. Used as an int extra field in BluetoothDevice.ActionBondStateChanged intents.
const
ExtraRssiString. Used as an optional short extra field in BluetoothDevice.ActionFound intents.
const
ExtraUuidString. Used as an extra field in BluetoothDevice.ActionUuid intents, Contains the ParcelUuids of the remote device which is a parcelable version of UUID.
const
PairingVariantPasskeyConfirmationInt32 (2). The user will be prompted to confirm the passkey displayed on the screen or an app will confirm the passkey for the user.
const
PairingVariantPinInt32 (0). The user will be prompted to enter a pin or an app will enter a pin for user.

Public Properties

[read-only]
AddressString. Returns the hardware address of this BluetoothDevice.
[read-only]
BluetoothClassBluetoothClass. Get the Bluetooth class of the remote device.
[read-only]
BondStateBond. Get the bond state of the remote device.
[read-only]
static
CreatorIParcelableCreator.
[read-only]
NameString. Get the friendly Bluetooth name of the remote device.
[read-only]
TypeBluetoothDeviceType. Get the Bluetooth device type of the remote device.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

ConnectGatt(Context, Boolean, BluetoothGattCallback) : BluetoothGatt
Connect to GATT Server hosted by this device.
CreateBond() : Boolean
Start the bonding (pairing) process with the remote device.
CreateInsecureRfcommSocketToServiceRecord(UUID) : BluetoothSocket
Create an RFCOMM BluetoothSocket socket ready to start an insecure outgoing connection to this remote device using SDP lookup of uuid.
CreateRfcommSocketToServiceRecord(UUID) : BluetoothSocket
Create an RFCOMM BluetoothSocket ready to start a secure outgoing connection to this remote device using SDP lookup of uuid.
DescribeContents() : Int32
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
FetchUuidsWithSdp() : Boolean
Perform a service discovery on the remote device to get the UUIDs supported.
GetUuids() : ParcelUuid[]
Returns the supported features (UUIDs) of the remote device.
SetPairingConfirmation(Boolean) : Boolean
Confirm passkey for BluetoothDevice.PairingVariantPasskeyConfirmation pairing.
SetPin(Byte[]) : Boolean
Set the pin during pairing when the pairing method is BluetoothDevice.PairingVariantPin
WriteToParcel(Parcel, ParcelableWriteFlags)
Flatten this object in to a Parcel.