How to get information about CONNECTED bluetooth device for android?
Asked Answered
I

3

6

If I have a Android phone which is already connected with a bluetooth headset (paired and connected) to it. How I can get information about that specific headset.

Using getBondedDevices() method I get list of all paired devices..I need information about CONNECTED device only.

I can not wait for broadcast receiver to check status, because I need this information at the start of my application. So please suggest is there any way to get this information without waiting for broadcast.

Intramural answered 23/8, 2011 at 10:43 Comment(1)
See my answer at #14991658Morin
Q
0

You can do this through the IBluetoothA2dp interface in API 11 and up. Some more info on there is here: Android connect to a paired bluetooth headset

Here is a great resource to see the difference in what is available to this interface between API 10 and 11 where it changed quite a bit. http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/bluetooth/BluetoothA2dp.java/?v=diff&id2=2.2_r1.1

Hope that helps.

Quathlamba answered 12/1, 2012 at 1:2 Comment(0)
L
0

You can use the getConnectedDevices for the HEADSET Profile to get the device to which it is connected.

Landside answered 12/1, 2012 at 1:25 Comment(0)
C
0

Check this out to see if headset is connected (ICS only):

    public boolean isVoiceConnected()
    {
        boolean retval = true;
        try {
            retval = BluetoothAdapter.getDefaultAdapter().getProfileConnectionState(android.bluetooth.BluetoothProfile.HEADSET) != android.bluetooth.BluetoothProfile.STATE_DISCONNECTED;

        } catch (Exception exc) {
            // nothing to do
        }
        return retval;
    }
Cardamom answered 18/9, 2012 at 12:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.