Skip to content
Equip your Android project with Bluetooth capabilities into minutes
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


platform: Android API Build Status codecov Known Vulnerabilities Download Gitter license: MPL 2.0

BluetoothWrapper Library's Logo

What is BluetoothWrapper

BluetoothWrapper, as its name calls, is a wrapper library around Android's Bluetooth built-in classes. It aims to enable quick and easy Bluetooth integration in your Android project without you having to read the official Android documentation.

Advantages of using this Bluetooth library:

  • No learning curve. The developer can use simple commands like connect, send and disconnect to control the connection. Thus, you are free to focus on other things that matter most.
  • Lightweight. It is a simple wrapper library which includes only the necessary methods for controlling the connection to a Bluetooth device.
  • No need to search for hours on the Internet on how to implement a way of receiving incoming Bluetooth messages in your custom class. We have done this for you. More details in the included example.
  • Easy subscription to notifications about the Bluetooth adapter's and connection's states
  • Debug options which give you more control over your project
  • Many utility methods for outputting the list of available devices
  • Well documented. Includes both Javadoc documentation with thorough commenting and a detailed application example
  • Scalable. The necessary things are already covered but you can very easily extend the library's capabilities depending on your project's requirements.


The library is available in JCenter and can be easily used by adding the following line into your project's dependencies on the bottom of the build.gradle file.

compile 'io.github.georgiosgoniotakis.bluetoothwrapper:bluetoothwrapper:1.1'

A first step is to include the library into your project's dependencies. After this step is over, you need to initialize a new object which is responsible for discovering the Bluetooth devices. Add in your preferred class, which is going to control the Bluetooth connection, the following line:
BTExplorer btExplorer = BTExplorer.getInstance(handler);

Get the list of Bluetooth device as a Set using the following command:
Set<BluetoothDevice> btDevices = btExplorer.pairedDevices();

Alternatively you can acquire a list of DEVICE_NAME, MAC_ADRESS String pairs using:

String[][] btDevices = btExplorer.deviceList(true);

NB: By setting this to true, the list is being printed in the logcat's information view.

After the user chooses the device of preferrence, initialize a connection by calling:

btExplorer.connect("00:00:00:00:00", Mode.SECURE);

Where 00:00:00:00:00 is the device's MAC address.

Upon successful connection to this device, the method which is reading the incoming messages is activated and the handler starts reporting these back to the class.

To send a message to an active device use:


Finally, to disconnect from an active device use:


To receive notifications about the connection, subscribe to the custom BroadcastReceivers (BTAdapterReceiver and BTDeviceReceiver).

If you have a current Context object the whole process is simplified by calling:

BTReceivers btReceivers = new BTReceivers(this, true);

And for unregistering the active receivers


An example of using all of the library's features in an Android application, and more detailed explanations can be found here

To gain a better insight of the library, please read the provided documentation

Complementary Information

For any issues or recommendations, please do not hesitate to use the repository's issue tracker or the Gitter channel. If you want to contribute to this project, please check

A full example of how to use this library with an Arduino board and a Bluetooth module can be found on this gist

Special thanks to Logomakr for the logo's resources

You can’t perform that action at this time.