Skip to content

Modules.Bluetooth.BluetoothDevice

Represents a remote bluetooth device.

A BluetoothDevice object lets you create a connection with the remote device or query information about it, such as the name, address, UUID and type.

Extends: Titanium.Proxy · Since: 1.0.0 · Platforms: android

Properties #

address#

Type: String

Address of the remote Bluetooth device.

This property returns the Bluetooth hardware address as string. For example, "00:11:22:AA:BB:CC".

name#

Type: String

Name of the remote Bluetooth device.

This property returns the Bluetooth name or null if there was a problem.

type#

Type: Number

Type of the remote Bluetooth device.

Possible values are DEVICE_TYPE_UNKNOWN, DEVICE_TYPE_CLASSIC, DEVICE_TYPE_DUAL and
DEVICE_TYPE_LE.

uUIDs#

Type: Array<String>

The supported UUIDs of the remote device.

This property does not start a service discovery procedure to retrieve the UUIDs from the
remote device. Rather, the local cached copy of the service UUIDs are returned. Can be null
on error.

Methods #

createSocket #

Creates an RFCOMM Bluetooth socket.

This method, when called, creates an RFCOMM Bluetooth socket ready to start an outgoing
connection to the remote device using SDP lookup of UUID.

Parameters:
NameTypeSummaryOptional
uuidStringUUID of the service this socket will connect to.No
secureBooleanDetermines whether the connection will be secure or insecure.Yes

Returns: Modules.Bluetooth.BluetoothSocket — created socket for the device

fetchUUIDs #

Perform a service discovery on the remote device to get the UUIDs supported.

The outcome of the discovery is reported via the fetchedUUIDs event.

Returns: Boolean — Returns true if service discovery started successfully.

Events #

fetchedUUIDs #

Fired when the UUIDs of the remote device are received using SDP.

Event Properties:
NameTypeSummary
deviceModules.Bluetooth.BluetoothDeviceThe Bluetooth device in question.
UUIDsArray<String>The service UUIDs of the device.

Titanium SDK Documentation