0

Im very new to samsung ble(bluetooth low energy) SDK. The thing is I want to get addresses of several devices which try to connect to my mobile phone. please help me. thanks in advance.

Pradeep.


Thank you Akuzma,

This function gives all the paired devices. But I need to get the address of the device which is currently communicating with my mobile phone. for example if my phone is connected to 3 devices, but currently it will be communicating with only first device. So I need to get the address of that device, instead of getting all the addresses of connected devices.

Thank you.

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72

1 Answers1

0

use BluetoothAdapter

http://developer.android.com/guide/topics/connectivity/bluetooth.html

Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// If there are paired devices
if (pairedDevices.size() > 0) {
    // Loop through paired devices
    for (BluetoothDevice device : pairedDevices) {
        // Add the name and address to an array adapter to show in a ListView
        mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
    }
}
akuzma
  • 1,592
  • 6
  • 22
  • 49
  • 1
    Thank you Akuzma, This function gives all the paired devices. But I need to get the address of the device which is currently communicating with my mobile phone. for example if my phone is connected to 3 devices, but currently it will be communicating with only first device. So I need to get the address of that device, instead of getting all the addresses of connected devices. Thank you. – Pradeep Damitha Senanayake Jul 31 '13 at 03:57