Search This Blog

Wednesday 19 November 2014

android Bluetooth

Basic :

Android Bluetooth provide support for Bluetooth network stack. it useful for exchange the data, audio or video wirelessly . The application framework provide the access the Bluetooth functionality and run over the android os. Bluetooth have point to point and multipoint wireless connection enabled.   

Functions :

1) Scan for the other bluetooth devices: for transfer the data wirelessly first of all it need to connect the that device which device having a data. for establish the connection the bluetooth scan for the that device.

2)Make a request for paired : after scanning the bluetooth the bluetooth send request for the make a paired. if that device accept that request it make a pair successfully.

3)Transfer the data: user can exchange the data between that point to point connections.

4) Manage the multipoint connection: Bluetooth provide the multipoint connection user can transfer the data multiply.   


permission for Bluetooth :


we need to permission to perform any Bluetooth connections.such transferring data connect the device and searching for the devices. if you want your app to initiated  device discovery or manipulated device setting you must declare Bluetooth admin permission most of device need to permission for discover able device

bluetooth permission example here:

<manifest ... >
  <uses-permission android:name="android.permission.BLUETOOTH" />
  ...</manifest>

Summary for bluetooth connections:


BluetoothAdapter
Represents the local Bluetooth adapter (Bluetooth radio). The BluetoothAdapter is the entry-point for all Bluetooth interaction. Using this, you can discover other Bluetooth devices, query a list of bonded (paired) devices, instantiate a BluetoothDevice using a known MAC address, and create a BluetoothServerSocketto listen for communications from other devices.

BluetoothDevice
Represents a remote Bluetooth device. Use this to request a connection with a remote device through aBluetoothSocket or query information about the device such as its name, address, class, and bonding state.

BluetoothSocket
Represents the interface for a Bluetooth socket (similar to a TCP Socket). This is the connection point that allows an application to exchange data with another Bluetooth device via InputStream and OutputStream.

BluetoothServerSocket
Represents an open server socket that listens for incoming requests (similar to a TCP ServerSocket). In order to connect two Android devices, one device must open a server socket with this class. When a remote Bluetooth device makes a connection request to the this device, the BluetoothServerSocket will return a connected BluetoothSocket when the connection is accepted.

BluetoothClass
Describes the general characteristics and capabilities of a Bluetooth device. This is a read-only set of properties that define the device's major and minor device classes and its services. However, this does not reliably describe all Bluetooth profiles and services supported by the device, but is useful as a hint to the device type.

BluetoothProfile
An interface that represents a Bluetooth profile. A Bluetooth profile is a wireless interface specification for Bluetooth-based communication between devices. An example is the Hands-Free profile. For more discussion of profiles, see Working with Profiles
BluetoothHeadset
Provides support for Bluetooth headsets to be used with mobile phones. This includes both Bluetooth Headset and Hands-Free (v1.5) profiles.

Bluetooth A2dp
Defines how high quality audio can be streamed from one device to another over a Bluetooth connection. "A2DP" stands for Advanced Audio Distribution Profile.

BluetoothHealth
Represents a Health Device Profile proxy that controls the Bluetooth service.

BluetoothHealthCallback
An abstract class that you use to implement BluetoothHealth callbacks. You must extend this class and implement the callback methods to receive updates about changes in the application’s registration state and Bluetooth channel state.

BluetoothHealthAppConfiguration
Represents an application configuration that the Bluetooth Health third-party application registers to communicate with a remote Bluetooth health device.

BluetoothProfile.ServiceListener
An interface that notifies BluetoothProfile IPC clients when they have been connected to or disconnected from the service (that is, the internal service that runs a particular profile).