|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.bluetooth.BluetoothHeadset
public class BluetoothHeadset
The Android Bluetooth API is not finalized, and *will* change. Use at your own risk. Public API for controlling the Bluetooth Headset Service. BluetoothHeadset is a proxy object for controlling the Bluetooth Headset Service. Creating a BluetoothHeadset object will create a binding with the BluetoothHeadset service. Users of this object should call close() when they are finished with the BluetoothHeadset, so that this proxy object can unbind from the service. BlueoothHeadset objects are not guarenteed to be connected to the BluetoothHeadsetService at all times. Calls on this object while not connected to the service will result in default error return values. Even after object construction, there is a short delay (~10ms) before this proxy object is actually connected to the Service. Android only supports one connected Bluetooth Headset at a time. Note that in this context, Headset includes both Bluetooth Headset's and Handsfree devices.
| Field Summary | |
|---|---|
static int |
RESULT_CANCELLED
Connection cancelled before completetion. |
static int |
RESULT_FAILURE
|
static int |
RESULT_SUCCESS
|
static int |
STATE_CONNECTED
A headset is currently connected |
static int |
STATE_CONNECTING
Connection attempt in progress |
static int |
STATE_DISCONNECTED
No headset currently connected |
static int |
STATE_ERROR
There was an error trying to obtain the state |
| Constructor Summary | |
|---|---|
BluetoothHeadset(Context context)
Create a BluetoothHeadset proxy object. |
|
| Method Summary | |
|---|---|
void |
close()
Close the connection to the backing service. |
boolean |
connectHeadset(String address,
IBluetoothHeadsetCallback callback)
Request to initiate a connection to a headset. |
boolean |
disconnectHeadset()
Disconnects the current headset. |
protected void |
finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. |
String |
getHeadsetAddress()
Get the Bluetooth address of the current headset. |
int |
getState()
Get the current state of the Bluetooth Headset service. |
boolean |
isConnected(String address)
Returns true if the specified headset is connected (does not include connecting). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STATE_ERROR
public static final int STATE_DISCONNECTED
public static final int STATE_CONNECTING
public static final int STATE_CONNECTED
public static final int RESULT_FAILURE
public static final int RESULT_SUCCESS
public static final int RESULT_CANCELLED
| Constructor Detail |
|---|
public BluetoothHeadset(Context context)
| Method Detail |
|---|
protected void finalize()
throws Throwable
ObjectNote: The virtual machine assumes that the implementation in class Object is empty.
finalize in class ObjectThrowable - The virtual machine ignores any exceptions which are
thrown during finalization.public void close()
public int getState()
public String getHeadsetAddress()
public boolean connectHeadset(String address,
IBluetoothHeadsetCallback callback)
address - The Bluetooth Address to connect to, or null to connect
to the last connected headset.callback - A callback with onCreateBondingResult() defined, or
null.
public boolean isConnected(String address)
public boolean disconnectHeadset()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||