1.What is Blue Tooth?
Bluetooth is a wireless technology standard for exchanging data over short distances from fixed and mobile devices, creating personal area networks with high levels of security.
Or
Bluetooth is a way to exchange data with other devices without any wired connection.
2.What Android Provides?
Bluetooth API to perform several tasks such as:
- Scan for other Bluetooth devices (including Bluetooth Low Energy devices)
- Query the local Bluetooth adapter for paired Bluetooth devices
- Establish RFCOMM channels/sockets
- Connect to specified sockets on other devices
- Transfer data to and from other devices
- Manage multiple connections
3.What Android BlueTooth API Provides?
The android.bluetooth package provides a lot of interfaces classes to work with bluetooth such as:
- BluetoothAdapter
- BluetoothDevice
- BluetoothAssignedNumbers
- BluetoothServerSocket
- BluetoothSocket
- BluetoothProfile
- BluetoothClass
- BluetoothHeadset
- BluetoothProfile.ServiceListener
- BluetoothA2dp
- BluetoothHealth
- BluetoothHealthCallback
- BluetoothHealthAppConfiguration
4.About BlueTooth Adapter Class?
BluetoothAdapter Represents the local device Bluetooth adapter.
BluetoothAdapter class can be used to perform fundamental tasks such as query a list of paired (bonded) devices, create a BluetoothServerSocket instance to listen for connection requests, initiate device discovery etc.
BluetoothAdapter class can be used to perform fundamental tasks such as query a list of paired (bonded) devices, create a BluetoothServerSocket instance to listen for connection requests, initiate device discovery etc.
5.What are the Constants of Bluetooth Adapter Class?
BluetoothAdapter class provides many constants. Some of them are as follows:
- String ACTION_REQUEST_DISCOVERABLE
- String ACTION_REQUEST_ENABLE
- String ACTION_DISCOVERY_STARTED
- String ACTION_DISCOVERY_FINISHED
- String ACTION_STATE_CHANGED
6.What are the Methods of Bluetooth Adapter Class?
BluetoothAdapter class provides many Methods. Some of them commonly used are as follows:
- boolean setName(String name): changes the bluetooth name.
- boolean enable(): enables the bluetooth adapter if it is disabled.
- static synchronized BluetoothAdapter getDefaultAdapter(): returns the instance of BluetoothAdapter.
- boolean isEnabled(): returns true if the bluetooth adapter is enabled.
- boolean disable(): disables the bluetooth adapter if it is enabled.
- String getName(): returns the name of the bluetooth adapter.
- int getState(): returns the current state of the local bluetooth adapter.
-
Set
getBondedDevices(): returns a set of paired (bonded) BluetoothDevice objects. - boolean startDiscovery(): starts the discovery process.