List of Bonded Bluetooth Devices Without Java

25 views
Skip to first unread message

John

unread,
Feb 10, 2012, 11:12:11 AM2/10/12
to android-platform
Hi,
I'm looking for a way to get a list of bonded bluetooth devices,
without using a Java VM. I need to duplicate the
BluetoothAdapter.getBondedDevices() call.

I've been looking through the Bluez library but can't see a way to
do this.

I can see that on my phone the bonded devices are listed in /data/
misc/bluetoothd/<address>/profiles, but my code doesn't have
permission to fopen that file.

Thanks.

Anup Kulkarni

unread,
Feb 22, 2012, 12:01:05 PM2/22/12
to android-...@googlegroups.com
Hi.

A dirty hack can be put in place to get a list of bonded devices from the path you mentioned below.

/data/misc/bluetoothd/<address>/profiles

Assuming you are using C - 

FILE *pipe = NULL;
char device[100] = {0};
pipe = popen("ls /data/misc/bluetoothd/", "r");
while (!feof(pipe)) {
    fgets(device, 100, pipe);
    printf("device - %s\n", device);
}

Similar logic you can put in place for reading the services on every device.

Thanks,
Anup



--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Reply all
Reply to author
Forward
0 new messages