android 蓝牙 sco建立,Android bluetooth SCO

I faced problem with bluetooth SCO audio in my android app.

I registered a receiver for actions ACL_CONNECTED and ACL_DISCONNECTED to capture the bluetooth SCO device connection and disconnection. On receive of ACL_CONNECTED I am checking whether bluetooth device has Audio service (headset) or not, if has AUDIO service, I am instantiating AudioTrack (new AudioTrack(....)) and starting bluetooth SCO (startBluetoothSco(); setBluetoothScoOn(true);).

I have a button in my app to write pcm data to AudioTrack. In this app I am not able to hear sound of PCM data i written.

I tried without any receiver and in onCreate() only I instantiated AudioTrack and started bluetooth SCO. Before launching app, I connected headset to my device and tested, it is working fine.

But, why my app is not working when established bluetooth SCO connection at run-time depending on ACL_CONNECTED intent.

If anybody know the solution please reply me. I added all required permissions BLUETOOTH, BLUETOOTH_ADMIN, MODIFY_AUDIO_SETTINGS (don't report about spelling mistakes in these permissions).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
蓝牙SCO(Synchronous Connection-Oriented)和A2DP(Advanced Audio Distribution Profile)是蓝牙技术中用于音频传输的两种不同的协议。 SCO是一种窄带语音传输协议,用于传输电话通话等窄带语音数据。它在蓝牙核心规范中定义,通常用于实现实时语音通信。SCO通道提供了实时性和低延迟的特性,但音质相对较低。 A2DP是一种高级音频分发协议,用于传输高质量音频数据,包括单声道、立体声或多声道音频。它定义了传输高质量音频的协议和过程,通常用于将音乐播放器的音频数据发送到耳机或音箱等设备。A2DP提供了更好的音质和音频体验,但可能会有较高的延迟。 因此,蓝牙SCO和A2DP在音频传输方面有着不同的应用场景和特点。SCO适用于实时语音通信,而A2DP适用于传输高质量音频。 #### 引用[.reference_title] - *1* *2* [Android Bluetooth A2DP](https://blog.csdn.net/hihan_5/article/details/127259755)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Android 蓝牙基础篇之 —— A2DP](https://blog.csdn.net/jacksinrow/article/details/86493794)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值