Android tutorial - Android bluetooth list | Android Bluetooth | Android Bluetooth list paired devices example - android app development - android studio - android development tutorial
Learn android - android tutorial - Android bluetooth list - android examples - android programs
- Here is a very simple example that I thought might be helpful to someone. I have included the four files that have content that is key to setting up the application.
- The program checks to see if the device has bluetooth. If the device does and it isn’t turned on the program will prompt the user to turn it one. Once bluetooth is running it lists the paired devices.
- The get Bounded Devices() method of Bluetooth Adapter class provides a set containing list of all paired or bounded bluetooth devices.
- In this example, we are checking if the bluetooth is turned off, if yes then turn it on and list all the paired devices.
- Drag one text view from the pallete, now the activity_main.xml file will like this:
File: activity_main.xml
Provide Permission
- You need to provide following permissions in AndroidManifest.xml file.
- The full code of AndroidManifest.xml file is given below.
- File: AndroidManifest.xml
Activity class
- Let's write the code to provide the list of paired (bounded) bluetooth devices.
- File: MainActivity.java