Does android support HFP bluetooth profile?

2020-07-23 09:39发布

问题:

Does android support Bluetooth HFP profile ? Or is it device dependent ?.

What are the profiles supported by Android at the OS level.

回答1:

Next profiles are natively supported by Android: A2DP, HFP, HSP. By "natively" I mean that Android is capable to stream audio to devices that support at least one of these profiles.

Handling of A2DP and HFP profiles is almost transparent to your application. You just play audio into STREAM_MUSIC and those devices will peek it up when connected.

Its much harder with HSP profile devices. Official API support for them was added in API Level 8 (Android 2.2) and you have to stream audio to STREAM_VOICE stream: see AudioManager.startBluetoothSco for more details. But detecting whether HSP device is connect was still officially unsupported (though there are workarounds for this).

In API Level 11 two new classes were introduced: BluetoothHeadset and BluetoothA2DP which make life much easier. These two classes existed in android since API Level 3, but they were included in official API only in 11th release (though these classes were changed dramatically since the 3rd API Level).