Smartband Talk - 音频通过它

fil*_*a01 5 sony text-to-speech android-audiomanager

我已经尝试了几天通过SmartBand Talk(SWR30)发送Google文本到语音的音频.我在AndroidManifest.xml上拥有正确的权限

PERMISSION_CONTROL_EXTENSION,BLUETOOTH_ADMIN,BLUETOOTH,MODIFY_AUDIO_SETTINGS,BROADCAST_STICKY

我正在使用此代码获取AudioManager:

mAudioManager = (AudioManager) context
            .getSystemService(Context.AUDIO_SERVICE);
Run Code Online (Sandbox Code Playgroud)

并使用AudioManager通过SmartBand Talk讲话,如下所示:

mAudioManager.setSpeakerphoneOn(false);
mAudioManager.startBluetoothSco();
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
mAudioManager.setBluetoothScoOn(true);
speakMethod();
Run Code Online (Sandbox Code Playgroud)

此解决方案适用于某些设备,这意味着我可以通过SmartBand Talk真正听到消息.但对于其他一些设备(如三星Galaxy S5 4.4.2,LG Nexus 5 Lollipop和索尼Z3 4.4.4),这个解决方案不起作用,因为很少有音频通过SmartBand Talk,几乎95%的时间都在手机,而不是配对的蓝牙设备.

我想知道设备扩展是否能够正常使用此方案,其中音频将被发送到蓝牙设备,正确配对电话.

我想知道是否有可能有稳定的东西,在每部手机上工作,或者如果不可能的话.

Ahm*_*rim 1

该代码片段看起来几乎是正确的。但它包含一些不必要的调用。

尽管如此,大多数来源都建议对某些智能手机调用 setSpeakerphoneOn(false) 。我发现Z3上没有必要。

您可以查看下面的链接文章。它展示了如何在支持 HFP 的设备上使用音频。它是为 SmartEyeglass 编写的。但它在 SmartBand Talk 上应该同样有效。

https://developer.sony.com/develop/wearables/smarteyeglass-sdk/guides/use-bluetooth-for-audio-io/