You are on page 1of 16

10/1/12

BluetoothDevice | Android Developers

public final class

Summary: Constants | Inherited Constants | Fields | Methods | Inherited Methods | [Expand All] Since: API Level 5

BluetoothDevice
extends Object implements Parcelable java.lang.Object android.bluetooth.BluetoothDevice

Class Overview
Represents a remote Bluetooth device. A B u t o h e i e leotDvc ( r f r n e a d o d b u t o h B u t o h e i e h m )lets you create a /eeec/nri/leot/leotDvc.tl 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 Butohdpe leotAatr ( r f r n e a d o d b u t o h B u t o h d p e . t l that was used /eeec/nri/leot/leotAatrhm) to create this B u t o h e i e leotDvc (rfrneadodbutohButoheiehm) /eeec/nri/leot/leotDvc.tl. To get a B u t o h e i e leotDvc
( r f r n e a d o d b u t o h B u t o h e i e h m ) use /eeec/nri/leot/leotDvc.tl,

Butohdpe.eRmtDvc(tig leotAatrgteoeeieSrn)
(rfrneadodbutohButohdpe.tlgteoeei /eeec/nri/leot/leotAatrhm#eRmtDvc e j v . a g S r n ) to create one representing a (aaln.tig)

device of a known MAC address (which you can get through device discovery with Butohdpe leotAatr ( r f r n e a d o d b u t o h B u t o h d p e . t l ) or get one from /eeec/nri/leot/leotAatrhm) the set of bonded devices returned by Butohdpe.eBneDvcs) leotAatrgtoddeie(
(rfrneadodbutohButohdpe.tlgtoddei /eeec/nri/leot/leotAatrhm#eBneDvc e ( ) You can then open a s).

Butohokt leotSce

( r f r n e a d o d b u t o h B u t o h o k t h m )for /eeec/nri/leot/leotSce.tl

communication with the remote device, using cetRcmSceTSrieeodUI) raefomoktoevcRcr(UD


(rfrneadodbutohButoheiehm#raefomo /eeec/nri/leot/leotDvc.tlcetRcmSc ktoevcRcr(aaui.UD) eTSrieeodjv.tlUI).

Note: Requires the B U T O H LEOT


(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

1/16

permission.

Developer Guides
For more information about using Bluetooth, read the Bluetooth (/guide/topics/wireless/bluetooth.html) developer guide. See Also Butohdpe leotAatr Butohokt leotSce

Summary
Constants String ACTION_ACL_CONNECTED Broadcast Action: Indicates a low level (ACL) connection has been established with a remote device. Broadcast Action: Indicates a low level (ACL) disconnection from a remote device.

String ACTION_ACL_DISCONNECTED

Broadcast Action: Indicates that a low level (ACL) disconnection has been String ACTION_ACL_DISCONNECT_REQUESTED requested for a remote device, and it will soon be disconnected. String ACTION_BOND_STATE_CHANGED Broadcast Action: Indicates a change in the bond state of a remote device. Broadcast Action: Bluetooth class of a remote device has changed. Broadcast Action: Remote device discovered. Broadcast Action: Indicates the friendly name of a remote device has been retrieved for the first time, or changed since the last retrieval. Broadcast Action: This intent is used to broadcast the U I UD wrapped as a P r e U i of aclud the remote device after it has

String ACTION_CLASS_CHANGED String ACTION_FOUND

String ACTION_NAME_CHANGED

String ACTION_UUID

10/1/12

BluetoothDevice | Android Developers

been fetched. int BOND_BONDED Indicates the remote device is bonded (paired). Indicates bonding (pairing) is in progress with the remote device. Indicates the remote device is not bonded (paired). Sentinel error value for this class. Used as an int extra field in ATO_ODSAECAGD CINBN_TT_HNE intents. Used as a Parcelable B u t o h l s extra field in leotCas A T O _ O N and CINFUD ATO_LS_HNE CINCASCAGD intents. Used as a Parcelable Butoheie l e o t D v c extra field in every intent broadcast by this class. Used as a String extra field in ATO_AECAGD C I N N M _ H N E and A T O _ O N intents. CINFUD Used as an int extra field in ATO_ODSAECAGD CINBN_TT_HNE intents. Used as an optional short extra field in A T O _ O N intents. CINFUD Used as an extra field in ATO_UD C I N U I intents, Contains the P r e U i s of the remote aclud device which is a parcelable version of U I . UD
[Expand]

int BOND_BONDING int BOND_NONE int ERROR

String EXTRA_BOND_STATE

String EXTRA_CLASS

String EXTRA_DEVICE

String EXTRA_NAME

String EXTRA_PREVIOUS_BOND_STATE String EXTRA_RSSI

String EXTRA_UUID

Inherited Constants

From interface android.os.Parcelable Fields public static final Creator<BluetoothDevice> CREATOR Public Methods createInsecureRfcommSocketToServiceRecord (UUID uuid) BluetoothSocket Create an RFCOMM B u t o h o k t l e o t S c e socket ready to start an insecure outgoing connection to this

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

10/1/12

BluetoothDevice | Android Developers

remote device using SDP lookup of uuid. createRfcommSocketToServiceRecord (UUID uuid) BluetoothSocket Create an RFCOMM B u t o h o k t l e o t S c e ready to start a secure outgoing connection to this remote device using SDP lookup of uuid. describeContents16 API level: () Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Android APIs

int

android android.accessibilityservice equals (Object o) android.accounts Compares this instance with the specified object and boolean android.animation indicates if they are equal. android.app fetchUuidsWithSdp () android.app.admin boolean Perform a service discovery on the remote device to android.app.backup android.appwidget get the UUIDs supported. android.bluetoothgetAddress () String Returns the hardware address of this android.content android.content.pm BluetoothDevice. android.content.res getBluetoothClass () BluetoothClass android.database Get the Bluetooth class of the remote device. android.database.sqlite getBondState () BluetoothA2dpint Get the bond state of the remote device. BluetoothAdapter getName () BluetoothAssignedNumbers String Get the friendly Bluetooth name of the remote device. BluetoothClass getUuids () BluetoothClass.Device ParcelUuid[] Returns the BluetoothClass.Device.Major supported features (UUIDs) of the remote BluetoothClass.Service device. BluetoothDevice hashCode () int BluetoothHeadset Returns an integer hash code for this object. BluetoothHealth toString () BluetoothHealthAppConfiguration BluetoothHealthCallback a string representation of this String Returns BluetoothDevice. BluetoothServerSocket BluetoothSocket
Use Tree Navigation

void

writeToParcel (Parcel out, int flags) Flatten this object in to a Parcel.


[Expand]

Inherited Methods From class java.lang.Object

From interface android.os.Parcelable

Constants

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

10/1/12

BluetoothDevice | Android Developers

public static final String ACTION_ACL_CONNECTED

Since: API Level 5

Broadcast Action: Indicates a low level (ACL) connection has been established with a remote device. Always contains the extra field E T A D V C XR_EIE
(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC ) .

ACL connections are managed automatically by the Android Bluetooth stack. Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.ACL_CONNECTED"

public static final String ACTION_ACL_DISCONNECTED

Since: API Level 5

Broadcast Action: Indicates a low level (ACL) disconnection from a remote device. Always contains the extra field E T A D V C XR_EIE
(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC ) .

ACL connections are managed automatically by the Android Bluetooth stack. Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.ACL_DISCONNECTED"

public static final String ACTION_ACL_DISCONNECT_REQUESTED

Since: API Level 5

Broadcast Action: Indicates that a low level (ACL) disconnection has been requested for a remote device, and it will soon be disconnected. This is useful for graceful disconnection. Applications should use this intent as a hint to immediately terminate higher level connections (RFCOMM, L2CAP, or profile connections) to the remote device.

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

5/16

10/1/12

BluetoothDevice | Android Developers

Always contains the extra field E T A D V C XR_EIE


(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC ) .

Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED"

public static final String ACTION_BOND_STATE_CHANGED

Since: API Level 5

Broadcast Action: Indicates a change in the bond state of a remote device. For example, if a device is bonded (paired). Always contains the extra fields E T A D V C XR_EIE
(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC )ETABN_TT , XR_ODSAE (rfrneadodbutohButoheiehm#XR_ODS /eeec/nri/leot/leotDvc.tlETABN_ T T )and E T A P E I U _ O D S A E AE XR_RVOSBN_TT (rfrneadodbutohButoheiehm#XR_RVO /eeec/nri/leot/leotDvc.tlETAPEI U_ODSAE. SBN_TT)

Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.BOND_STATE_CHANGED"

public static final String ACTION_CLASS_CHANGED Since: API Level 5


Broadcast Action: Bluetooth class of a remote device has changed. Always contains the extra fields E T A D V C XR_EIE
(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC )and E T A C A S XR_LS (rfrneadodbutohButoheiehm#XR_LS) /eeec/nri/leot/leotDvc.tlETACAS.

Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. See Also ERRButohls}/@ikButohls} RO(leotCas {ln leotCas) Constant Value:

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

6/16

10/1/12

BluetoothDevice | Android Developers

"android.bluetooth.device.action.CLASS_CHANGED"

public static final String ACTION_FOUND


Broadcast Action: Remote device discovered. Sent when a remote device is found during discovery. Always contains the extra fields E T A D V C XR_EIE

Since: API Level 5

(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC )and E T A C A S XR_LS (rfrneadodbutohButoheiehm#XR_LS) /eeec/nri/leot/leotDvc.tlETACAS.

Can contain the extra fields E T A N M XR_AE


(rfrneadodbutohButoheiehm#XR_AE /eeec/nri/leot/leotDvc.tlETANM)

and/or E T A R S XR_SI
( r f r n e a d o d b u t o h B u t o h e i e h m # X R _ S I if /eeec/nri/leot/leotDvc.tlETARS)

they are available. Requires B U T O H LEOT


( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.FOUND"

public static final String ACTION_NAME_CHANGED

Since: API Level 5

Broadcast Action: Indicates the friendly name of a remote device has been retrieved for the first time, or changed since the last retrieval. Always contains the extra fields E T A D V C XR_EIE
(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC )and E T A N M XR_AE (rfrneadodbutohButoheiehm#XR_AE. /eeec/nri/leot/leotDvc.tlETANM)

Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.NAME_CHANGED"

public static final String ACTION_UUID

Since: API Level 15

Broadcast Action: This intent is used to broadcast the U I UD ( r f r n e j v / t l U I . t l wrapped as a P r e U i /eeec/aaui/UDhm) aclud ( r f r n e a d o d o / a c l u d h m )of the remote device after /eeec/nri/sPreUi.tl it has been fetched. This intent is sent only when the UUIDs of the remote device are requested to be fetched using Service Discovery Protocol

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

7/16

10/1/12

BluetoothDevice | Android Developers

Always contains the extra field E T A D V C XR_EIE


(rfrneadodbutohButoheiehm#XR_EIE /eeec/nri/leot/leotDvc.tlETADVC )

Always contains the extra field E T A U I XR_UD


(rfrneadodbutohButoheiehm#XR_UD /eeec/nri/leot/leotDvc.tlETAUI)

Requires B U T O H LEOT
( r f r n e a d o d M n f s . e m s i n h m # L E O T )to /eeec/nri/aietpriso.tlBUTOH

receive. Constant Value: "android.bluetooth.device.action.UUID"

public static final int BOND_BONDED


Indicates the remote device is bonded (paired). A shared link keys exists locally for the remote device, so communication can be authenticated and encrypted.

Since: API Level 5

Being bonded (paired) with a remote device does not necessarily mean the device is currently connected. It just means that the pending procedure was completed at some earlier time, and the link key is still stored locally, ready to use on the next connection. Constant Value: 12 (0x0000000c)

public static final int BOND_BONDING

Since: API Level 5

Indicates bonding (pairing) is in progress with the remote device. Constant Value: 11 (0x0000000b)

public static final int BOND_NONE


Indicates the remote device is not bonded (paired).

Since: API Level 5

There is no shared link key with the remote device, so communication (if it is allowed at all) will be unauthenticated and unencrypted. Constant Value: 10 (0x0000000a)

public static final int ERROR

Since: API Level 5

Sentinel error value for this class. Guaranteed to not equal any other integer constant in this class. Provided as a convenience for functions that require a sentinel error value, for example: Itn.eItxr(leotDvc.XR_ODSAE netgtnEtaButoheieETABN_TT,

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

8/16

10/1/12

BluetoothDevice | Android Developers

ButoheieERR leotDvc.RO) Constant Value: -2147483648 (0x80000000)

public static final String EXTRA_BOND_STATE

Since: API Level 5

Used as an int extra field in A T O _ O D S A E C A G D CINBN_TT_HNE


(rfrneadodbutohButoheiehm#CINBN_ /eeec/nri/leot/leotDvc.tlATO_OD S A E C A G D intents. Contains the bond state of TT_HNE)

the remote device.

Possible values are: B N _ O E ODNN


(rfrneadodbutohButoheiehm#ODNN) /eeec/nri/leot/leotDvc.tlBN_OE,

BN_ODN ODBNIG
(rfrneadodbutohButoheiehm#ODBNIG /eeec/nri/leot/leotDvc.tlBN_ODN )BN_ODD , ODBNE (rfrneadodbutohButoheiehm#ODBNE) /eeec/nri/leot/leotDvc.tlBN_ODD.

Constant Value: "android.bluetooth.device.extra.BOND_STATE"

public static final String EXTRA_CLASS


Used as a Parcelable B u t o h l s leotCas

Since: API Level 5

( r f r n e a d o d b u t o h B u t o h l s . t l extra /eeec/nri/leot/leotCashm)

field in

ATO_ON CINFUD
(rfrneadodbutohButoheiehm#CINFUD /eeec/nri/leot/leotDvc.tlATO_ON )and A T O _ L S _ H N E CINCASCAGD (rfrneadodbutohButoheiehm#CINCAS /eeec/nri/leot/leotDvc.tlATO_LS _ H N E )intents. CAGD

Constant Value: "android.bluetooth.device.extra.CLASS"

public static final String EXTRA_DEVICE


Used as a Parcelable B u t o h e i e leotDvc

Since: API Level 5

( r f r n e a d o d b u t o h B u t o h e i e h m )extra /eeec/nri/leot/leotDvc.tl

field in every intent broadcast by this class. It contains the B u t o h e i e leotDvc ( r f r n e a d o d b u t o h B u t o h e i e h m )that the /eeec/nri/leot/leotDvc.tl intent applies to. Constant Value: "android.bluetooth.device.extra.DEVICE"

public static final String EXTRA_NAME


Used as a String extra field in A T O _ A E C A G D CINNM_HNE

Since: API Level 5

(rfrneadodbutohButoheiehm#CINNM_ /eeec/nri/leot/leotDvc.tlATO_AE C A G D and A T O _ O N HNE) CINFUD (rfrneadodbutohButoheiehm#CINFUD /eeec/nri/leot/leotDvc.tlATO_ON

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

10/1/12

BluetoothDevice | Android Developers

)intents. It contains the friendly Bluetooth name.

Constant Value: "android.bluetooth.device.extra.NAME"

public static final String EXTRA_PREVIOUS_BOND_STATE

Since: API Level 5

Used as an int extra field in A T O _ O D S A E C A G D CINBN_TT_HNE


(rfrneadodbutohButoheiehm#CINBN_ /eeec/nri/leot/leotDvc.tlATO_OD S A E C A G D intents. Contains the previous bond state of TT_HNE)

the remote

device. Possible values are: B N _ O E ODNN


(rfrneadodbutohButoheiehm#ODNN) /eeec/nri/leot/leotDvc.tlBN_OE,

BN_ODN ODBNIG
(rfrneadodbutohButoheiehm#ODBNIG /eeec/nri/leot/leotDvc.tlBN_ODN )BN_ODD , ODBNE (rfrneadodbutohButoheiehm#ODBNE) /eeec/nri/leot/leotDvc.tlBN_ODD.

Constant Value: "android.bluetooth.device.extra.PREVIOUS_BOND_STATE"

public static final String EXTRA_RSSI


Used as an optional short extra field in A T O _ O N CINFUD

Since: API Level 5

(rfrneadodbutohButoheiehm#CINFUD /eeec/nri/leot/leotDvc.tlATO_ON )intents. Contains the RSSI value of

the remote device as reported by

the Bluetooth hardware. Constant Value: "android.bluetooth.device.extra.RSSI"

public static final String EXTRA_UUID


Used as an extra field in A T O _ U D CINUI

Since: API Level 15

(rfrneadodbutohButoheiehm#CINUI) /eeec/nri/leot/leotDvc.tlATO_UD

intents, Contains the P r e U i aclud


( r f r n e a d o d o / a c l u d h m ) of /eeec/nri/sPreUi.tls

the remote device

which is a parcelable version of U I UD (rfrnejv/tlUI.tl. /eeec/aaui/UDhm) Constant Value: "android.bluetooth.device.extra.UUID"

Fields
public static final Creator<BluetoothDevice> CREATOR

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

10/1/12

BluetoothDevice | Android Developers

Since: API Level 5

Public Methods
public BluetoothSocket createInsecureRfcommSocketToServiceRecord (UUID uuid)
Create an RFCOMM B u t o h o k t leotSce
( r f r n e a d o d b u t o h B u t o h o k t h m )socket ready /eeec/nri/leot/leotSce.tl

Since: API Level 10

to start an insecure outgoing connection to this remote device using SDP lookup of uuid. The communication channel will not have an authenticated link key i.e it will be subject to man-in-the-middle attacks. For Bluetooth 2.1 devices, the link key will be encrypted, as encryption is mandatory. For legacy devices (pre Bluetooth 2.1 devices) the link key will be not be encrypted. Use c e t R c m S c e T S r i e e o d U I ) raefomoktoevcRcr(UD
(rfrneadodbutohButoheiehm#raefom /eeec/nri/leot/leotDvc.tlcetRcm S c e T S r i e e o d j v . t l U I ) if oktoevcRcr(aaui.UD)

an encrypted and authenticated communication channel is desired. This is designed to be used with lseUigneuefomihevcRcr(tig itnsnIscrRcmWtSrieeodSrn, UI) UD
(rfrneadodbutohButohdpe.tllseUig /eeec/nri/leot/leotAatrhm#itnsn IscrRcmWtSrieeodjv.agSrn, neuefomihevcRcr(aaln.tig j v . t l U I ) for peer-peer Bluetooth applications. aaui.UD)

Use c n e t ) onc(
( r f r n e a d o d b u t o h B u t o h o k t h m # o n c ( )to /eeec/nri/leot/leotSce.tlcnet)

initiate the outgoing connection. This will also perform an SDP lookup of the given uuid to determine which channel to connect to. The remote device will be authenticated and communication on this socket will be encrypted. Hint: If you are connecting to a Bluetooth serial board then try using the well-known SPP UUID 00001101-0000-1000-800000805F9B34FB. However if you are connecting to an Android peer then please generate your own unique UUID. Requires B U T O H LEOT
(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH

Parameters uuid service record uuid to lookup RFCOMM channel

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

11/16

10/1/12

BluetoothDevice | Android Developers

Returns a RFCOMM BluetoothServerSocket ready for an outgoing connection Throws IOException on error, for example Bluetooth not available, or insufficient permissions

public BluetoothSocket createRfcommSocketToServiceRecord (UUID uuid) Since: API Level 5


Create an RFCOMM B u t o h o k t leotSce
( r f r n e a d o d b u t o h B u t o h o k t h m )ready to start /eeec/nri/leot/leotSce.tl

a secure outgoing connection to this remote device using SDP lookup of uuid. This is designed to be used with lseUigfomihevcRcr(tig UI) itnsnRcmWtSrieeodSrn, UD
(rfrneadodbutohButohdpe.tllseUig /eeec/nri/leot/leotAatrhm#itnsn R c m W t S r i e e o d j v . a g S r n , j v . t l U I ) for fomihevcRcr(aaln.tig aaui.UD)

peer-peer Bluetooth applications. Use c n e t ) onc(


( r f r n e a d o d b u t o h B u t o h o k t h m # o n c ( )to /eeec/nri/leot/leotSce.tlcnet)

initiate the outgoing connection. This will also perform an SDP lookup of the given uuid to determine which channel to connect to. The remote device will be authenticated and communication on this socket will be encrypted. Use this socket only if an authenticated socket link is possible. Authentication refers to the authentication of the link key to prevent man-in-the-middle type of attacks. For example, for Bluetooth 2.1 devices, if any of the devices does not have an input and output capability or just has the ability to display a numeric key, a secure socket connection is not possible. In such a case, use {#link createInsecureRfcommSocketToServiceRecord}. For more details, refer to the Security Model section 5.2 (vol 3) of Bluetooth Core Specification version 2.1 + EDR. Hint: If you are connecting to a Bluetooth serial board then try using the well-known SPP UUID 00001101-0000-1000-800000805F9B34FB. However if you are connecting to an Android peer then please generate your own unique UUID. Requires B U T O H LEOT
(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH

Parameters

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

12/16

BluetoothDevice | Android Developers

uuid Returns

service record uuid to lookup RFCOMM channel

a RFCOMM BluetoothServerSocket ready for an outgoing connection Throws IOException on error, for example Bluetooth not available, or insufficient permissions

public int describeContents ()

Since: API Level 5

Describe the kinds of special objects contained in this Parcelable's marshalled representation. Returns a bitmask indicating the set of special object types marshalled by the Parcelable.

public boolean equals (Object o)

Since: API Level 5

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null. The default implementation returns t u only if t i = o See re hs = . Writing a correct e u l method qas (/reference/java/lang/Object.html#writing_equals) if you intend implementing your own e u l method. qas The general contract for the e u l and h s C d ( qas ahoe) ( r f r n e j v / a g O j c . t l h s C d ( )methods is that if /eeec/aaln/bethm#ahoe) e u l returns t u for any two objects, then h s C d ( must qas re ahoe) return the same value for these objects. This means that subclasses of O j c usually override either both methods or neither of them. bet Parameters o the object to compare this instance with.

Returns t u if the specified object is equal to this O j c ; f l e re b e t a s otherwise.

public boolean fetchUuidsWithSdp ()

Since: API Level 15

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

13/16

10/1/12

BluetoothDevice | Android Developers

This API is asynchronous and A T O _ U D CINUI


(rfrneadodbutohButoheiehm#CINUI) /eeec/nri/leot/leotDvc.tlATO_UD

intent is sent, with the UUIDs supported by the remote end. If there is an error in getting the SDP records or if the process takes a long time, ATO_UD CINUI
(rfrneadodbutohButoheiehm#CINUI) /eeec/nri/leot/leotDvc.tlATO_UD

intent is sent with the UUIDs that is currently present in the cache. Clients should use the g t u d ( eUis)
(rfrneadodbutohButoheiehm#eUis) /eeec/nri/leot/leotDvc.tlgtud()

to get UUIDs if service discovery is not to be performed. Requires B U T O H LEOT


(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH.

Returns False if the sanity check fails, True if the process of initiating an ACL connection to the remote device was started.

public String getAddress ()


Returns the hardware address of this BluetoothDevice. For example, "00:11:22:AA:BB:CC". Returns Bluetooth hardware address as string

Since: API Level 5

public BluetoothClass getBluetoothClass ()


Get the Bluetooth class of the remote device. Requires B U T O H LEOT

Since: API Level 5

(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH.

Returns Bluetooth class object, or null on error

public int getBondState ()


Get the bond state of the remote device. Possible values for the bond state are: B N _ O E ODNN

Since: API Level 5

(rfrneadodbutohButoheiehm#ODNN) /eeec/nri/leot/leotDvc.tlBN_OE,

BN_ODN ODBNIG
(rfrneadodbutohButoheiehm#ODBNIG /eeec/nri/leot/leotDvc.tlBN_ODN )BN_ODD , ODBNE (rfrneadodbutohButoheiehm#ODBNE) /eeec/nri/leot/leotDvc.tlBN_ODD.

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

10/1/12

BluetoothDevice | Android Developers

Requires B U T O H LEOT
(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH.

Returns the bond state

public String getName ()


Get the friendly Bluetooth name of the remote device.

Since: API Level 5

The local adapter will automatically retrieve remote names when performing a device scan, and will cache them. This method just returns the name for this device from the cache. Requires B U T O H LEOT
(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH

Returns the Bluetooth name, or null if there was a problem.

public ParcelUuid[] getUuids ()

Since: API Level 15

Returns the supported features (UUIDs) of the remote device. This method does not start a service discovery procedure to retrieve the UUIDs from the remote device. Instead, the local cached copy of the service UUIDs are returned. Use f t h u d W t S p ) ecUisihd(
(rfrneadodbutohButoheiehm#ecUisi /eeec/nri/leot/leotDvc.tlfthudW t S p ) if hd()

fresh UUIDs are desired.

Requires B U T O H LEOT
(rfrneadodMnfs.emsinhm#LEOT) /eeec/nri/aietpriso.tlBUTOH.

Returns the supported features (UUIDs) of the remote device, or null on error

public int hashCode ()

Since: API Level 5

Returns an integer hash code for this object. By contract, any two objects for which e u l ( b e t qasOjc)
(rfrnejv/agOjc.tleul(aaln.bet) /eeec/aaln/bethm#qasjv.agOjc)

returns t u must return the same hash code value. This means that re subclasses of O j c usually override both methods or neither bet method. Note that hash values must not change over time unless information

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

15/16

10/1/12

used in equals comparisons also changes. See Writing a correct h s C d method ahoe
(/reference/java/lang/Object.html#writing_hashCode)

if you intend implementing

your own h s C d method. ahoe Returns this object's hash code.

public String toString ()


Returns a string representation of this BluetoothDevice.

Since: API Level 5

Currently this is the Bluetooth hardware address, for example "00:11:22:AA:BB:CC". However, you should always use g t d r s ( eAdes)
(rfrneadodbutohButoheiehm#eAdes) /eeec/nri/leot/leotDvc.tlgtdrs( )if

you explicitly require the Bluetooth hardware address in case the tSrn( otig)
(rfrneadodbutohButoheiehm#otig) /eeec/nri/leot/leotDvc.tltSrn()

representation changes in the future. Returns string representation of this BluetoothDevice

public void writeToParcel (Parcel out, int flags)


Flatten this object in to a Parcel. Parameters out flags

Since: API Level 5

The Parcel in which the object should be written. Additional flags about how the object should be written. May be 0 or P R E A L _ R T _ E U N V L E ACLBEWIERTR_AU.

developer.android.com/reference/android/bluetooth/BluetoothDevice.html

16/16

You might also like