Return a Set of BluetoothDevice objects that are currently bonded (paired) - Android Bluetooth

Android examples for Bluetooth:Bluetooth Bond

Description

Return a Set of BluetoothDevice objects that are currently bonded (paired)

Demo Code


//package com.java2s;

import java.util.HashSet;
import java.util.Set;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;

public class Main {

    private static Set<BluetoothDevice> getBondedDevices(
            BluetoothAdapter adapter) {/*from  ww w . j  a v a 2s . c  om*/
        Set<BluetoothDevice> results = adapter.getBondedDevices();
        if (results == null) {
            results = new HashSet<BluetoothDevice>();
        }
        return results;
    }
}

Related Tutorials