Android examples for android.bluetooth:Bluetooth Pair
get Paired Bluetooth Devices
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.util.Log; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Set; public class Main{ private static BluetoothAdapter mBluetoothAdapter; public static Set<BluetoothDevice> getPairedDevices() { if (mBluetoothAdapter == null) { initBluetooth();// ww w . j ava 2 s . c o m } return mBluetoothAdapter.getBondedDevices(); } public static boolean initBluetooth() { boolean state = false; mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (!mBluetoothAdapter.isEnabled()) { System.out.println("Bluetooth is Disable..."); state = true; } else if (mBluetoothAdapter.isEnabled()) { String address = mBluetoothAdapter.getAddress(); String name = mBluetoothAdapter.getName(); System.out.println(String.format( "Bluetooth name: %s. Address: %s", name, address)); state = false; } return state; } }