Bluetooth
The Android platform supports the Bluetooth network protocol stack, which allows the device to wirelessly exchange data with other Bluetooth devices. The application framework provides access to Bluetooth via the Android Bluetooth APIs. These APIs enable applications to wirelessly connect to other Bluetooth devices, making point-to-point and multipoint wireless capabilities.
Using Bluetooth APIs, the Android app can perform the following functions:
- Scan other Bluetooth devices
- Querying the local Bluetooth adapter for pairing Bluetooth devices
- Establish Rfcomm Channel
- Connect to other devices by discovering service discovery
- Exchanging data and other devices
- Managing Multiple connections
The Basics
This document describes how to use the Android Bluetooth APIs to complete four main tasks to use Bluetooth communication: Install Bluetooth, find a paired device, or connect devices on a locally available device to exchange data between devices.
All classes are android.bluetooth This package, here is an overview of the class:
Bluetoothadapter
Represents the local Bluetooth adapter (Bluetooth listener), Bluetoothadapter is the gateway to all Bluetooth conversations. Use it to discover other Bluetooth devices, find a list of paired devices, initialize a bluetoothdevice using a known MAC address, create a bluetoothserversocket to listen to other devices to communicate
Bluetoothdevice
Represents a remote Bluetooth device. The remote device uses it to initiate a connection via bluetoothsocket or to query the device's name, address, class name, and pairing status
Bluetoothsocket
Used to exchange data through InputStream and OutputStream.
Bluetoothserversocket
To listen for requests, two devices in order to connect, a device must open a server socket through this class when the remote Bluetooth device initiates a connection to connect to this device, Bluetoothserversocket will return an already connected bluetoothsocket when the connection is accepted
Bluetoothclass
Describes the general features and functions of a Bluetooth device. This is a set of read-only properties that define the device's primary and secondary device classes and their services. However, this does not reliably describe all Bluetooth profiles and services supported by the device, but hints on device types are useful.
Bluetoothprofile
Represents the interface for a Bluetooth profile. A Bluetooth profile is a wireless interface specification between Bluetooth-based devices. An example is Hands-free profile. For more discussion of configuration files, see Working with Profiles (links to crossing web)
Bluetoothheadset
Bluetooth Headset support available
Bluetootha2dp
Defines how high-quality audio is transferred from one device to another through a Bluetooth connection. "A2DP" represents an advanced audio distribution.
Bluetoothprofile.servicelistener
An interface that notifies the Bluetoothprofile IPC client when they have been connected or disconnected with the service (that is, the internal service runs a specific profile).
Android Developer--Bluetooth article overview