find Paired Bluetooth Device - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth Pair

Description

find Paired Bluetooth Device

Demo Code

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Set;
import java.util.UUID;

public class Main{


    public static Set<BluetoothDevice> findPaired() {

        BluetoothAdapter bluetoothAdapter = BluetoothAdapter
                .getDefaultAdapter();/*from  w w w . ja  v a  2 s  .  co m*/
        Set<BluetoothDevice> devices = bluetoothAdapter.getBondedDevices();

        if (devices == null || devices.isEmpty()) {
            return null;

        } else {
            return devices;
        }

    }

}

Related Tutorials