开发者

How to determine BT headset type (SCO or A2DP) in Android SDK?

开发者 https://www.devze.com 2023-03-01 17:41 出处:网络
I have a broadcast receiver in my app that logs every connection of a BT device by tracking the android.bluetooth.device.action.ACL_CONNECTED broadcast. But I need to know if the BT device isa headset

I have a broadcast receiver in my app that logs every connection of a BT device by tracking the android.bluetooth.device.action.ACL_CONNECTED broadcast. But I need to know if the BT device isa headset, and more importantly, if it's an SCO or an A2DP headse开发者_高级运维t. I can find out what services the connected device supports using BluetoothClass.Service, but I don't know which services are supposed to correspong to each type of headset. Here are the ones listed:

AUDIO 
CAPTURE
INFORMATION 
LIMITED_DISCOVERABILITY 
NETWORKING 
OBJECT_TRANSFER 
POSITIONING 
RENDER 
TELEPHONY

Can anyone tell me which of these determiny the headset profile type (headset, hands-free, or A2DP?


You can use BluetoothProfile.ServiceListener and listen for onServiceConnetced and you will get notifications for A2DP or SCO connected. See here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号