This article translated from: http://developer.android.com/guide/topics/connectivity/bluetooth.html#Permissions
The Android platform includes support for the Bluetooth network protocol stack, which allows a bluetooth device to exchange wireless data with other Bluetooth devices. Applications use the android Bluetooth API to access Bluetooth. These APIs connect applications to other Bluetooth devices wirelessly, with point-to-point and multi-point wireless features.
Using the Bluetooth API, Android applications can perform the following functions:
1. Scan other Bluetooth devices
2. query the locally paired Bluetooth adapter
3. Establish RFCOMM Channel
4. connect to other devices through service discovery
5. data transmission between devices
6. manage multiple Bluetooth connections
Basic
This article describes how to use the android Bluetooth API to complete the four main tasks required for Bluetooth communication: set Bluetooth, search for Bluetooth devices that are paired or available in the region, connect devices, and transmit data between devices.
All available APIs are included in the Android. Bluetooth package. The following describes the classes and interfaces required to create a Bluetooth connection:
Descrithadapter
Represents the local Bluetooth adapter (Bluetooth wireless ). Descrithadapter is the entrance to all Bluetooth interactions. By using this class, you can find other Bluetooth devices, query the list of paired devices, and instantiate a receivthdevice object using a known MAC address, create a thserversocket object to listen for communication with other devices.
Descrithdevice
Represents a remote Bluetooth device. You can use this class to request a connection to a remote device by using thsocket or querying device information such as name, address, class, and pairing status.
Descrithsocket
Represents a Bluetooth socket interface (similar to a TCP socket ). This is a connection point that allows an application to exchange data with another bluetooth device through the input stream and output stream.
Bluetoothserversocket
Indicates a service interface (similar to a TCP serversocket) that opens a listener for incoming requests ). To connect two Android devices, a device must use this class to open a service interface. When a remote Bluetooth device requests a connection with this device, the thserversocket will return a connected thsocket object when the connection is received.
Bluetoothclass
Describes the general features and functions of a bluetooth device. This class is a read-only property set that defines the Primary and Secondary device classes and services of the device. However, this class does not guarantee that all Bluetooth configurations and services supported by the device are described, but this kind of prompt is helpful for the device type.
Descrithprofile
Represents a Bluetooth configuration interface. Bluetooth configuration is a wireless interface specification between devices based on Bluetooth communication. One example is hands-free configuration. For more configuration discussions, see the configuration below.
Bluetoothheadset
Provides support for mobile phones using Bluetooth headsets. It also contains the configuration of Bluetooth headset and hands-free (v1.5.
Bluetootha2dp
Defines how to transfer high-quality audio from one device to another through a Bluetooth connection. "A2dp" is the abbreviation of Advanced Audio distribution profile.
Descrithhealth
Represents a proxy for controlling the Bluetooth service configured by a health care device.
Descrithhealthcallback
Abstract class used to implement callback thhealth. You must inherit this class and implement its callback method to receive updates to the Application Registration Status and Bluetooth channel status changes.
Descrithhealthappconfiguration
Represents the configuration of communication with a remote Bluetooth health care device registered by a third-party health care application related to Bluetooth.
Descrithprofile. servicelistener
Bluetoothprofile IPC client connects to or disconnects the service notification interface (it is an internal service that runs a special configuration ).