Bluetooth Program in Android

57 views.

The Android platform includes support for the Bluetooth network stack, which allows a device to wirelessly exchange data with other Bluetooth devices. The application framework provides access to the Bluetooth functionality through the Android Bluetooth APIs. These APIs let applications wirelessly connect to other Bluetooth devices, enabling point-to-point and multipoint wireless features.

Using the Bluetooth APIs, an Android application can perform the following:

Scan for other Bluetooth devices
Query the local Bluetooth adapter for paired Bluetooth devices
Establish RFCOMM channels
Connect to other devices through service discovery
Transfer data to and from other devices
Manage multiple connections

Methods discription
enable() : This method enables the adapter if not enabled

isEnabled() : This method returns true if adapter is enabled

disable() : This method disables the adapter

getName(): This method returns the name of the Bluetooth adapter

setName(String name) : This method changes the Bluetooth name

getState(): This method returns the current state of the Bluetooth Adapter.

startDiscovery(): This method starts the discovery process of the Bluetooth for 120 seconds.

activity_main.xml

 

MainActivity.java

AndroidManifest.xml

 

You may also like...

Leave a Reply