Course Content

Course Content

Bonding with Bluetooth Devices in Android

Bonding with Bluetooth devices in Android


In today's video our topic is Bonding with Bluetooth Devices in Android.

Once you enable the Bluetooth, you can get a list of paired device by calling getBondedDevices() method. It returns a set of bluetooth devices

Syntax :

private Set<BluetoothDevice>pairedDevices;


There are different methods of bluetooth adaptor class like enable(), isEnabled(),

disable(), getName(),

setName(String name), getState(), startDiscovery() etc...

We need to use one Client Server Mechanism to transfer files from one bluetooth to another.

The server and client are considered connected to each other when they each have a connected Bluetooth Socket on the same RFCOMM channel. At this point each device can obtain input and output streams and data transfer can begin.

The service device and the client device each obtain the required Bluetooth socket in different ways. The server will receive it when an incoming connection is accepted. The client will receive it when it opens an RFCOMM channel to the server.

The purpose of the server socket is to listen for incoming connection requests and when one is accepted, provide a connected BluetoothSocket. If you over data communication task then disconnect it.

The steps for connecting Server Socket are as follows :

  1. Get a BluetoothServerSocket by calling the listenUsingRfcommWithServiceRecord(String,UUID).
  2. Start listening for connection requests by calling accept().
  3. Unless you want to accept additional connections, call close().


Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
App Store
397K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
13K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere