How to check Device Near By Your Phone having Bluetooth?


final BluetoothDevice device = bluetooth.getRemoteDevice("01:23:77:35:2F:AA");
final Set<BluetoothDevice> bondedDevices = bluetooth.getBondedDevices();

BroadcastReceiver discoveryResult = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
BluetoothDevice remoteDevice =
intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if ((remoteDevice.equals(device) &&
(bondedDevices.contains(remoteDevice)) {
// TODO Target device is paired and discoverable
}
};
registerReceiver(discoveryResult, new IntentFilter(BluetoothDevice.ACTION_FOUND));

if (!bluetooth.isDiscovering())

bluetooth.startDiscovery();



Comments

  1. hello could you please explain a bit more this is that I try to do this and shows me errors and I really need to learn how to scan for other bluetooth please: (it connects to a draft plus a band WearLink heart rate monitor bluetooth to make a

    ReplyDelete

Post a Comment

Popular posts from this blog

Bluetooth Data Transfer Example

How to Create & Extract tar.gz and tar.bz2 Files in Linux