Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smartband Talk - Audio through it

I've been trying for a few days to send Google Text-to-speech audio through SmartBand Talk (SWR30). I have the correct permission on AndroidManifest.xml

PERMISSION_CONTROL_EXTENSION, BLUETOOTH_ADMIN, BLUETOOTH, MODIFY_AUDIO_SETTINGS, BROADCAST_STICKY

And I'm using this code to get AudioManager:

mAudioManager = (AudioManager) context
            .getSystemService(Context.AUDIO_SERVICE);

And using AudioManager to speak through SmartBand Talk like this:

mAudioManager.setSpeakerphoneOn(false);
mAudioManager.startBluetoothSco();
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
mAudioManager.setBluetoothScoOn(true);
speakMethod();

This solution works for some devices, meaning that I can really hear the message through SmartBand Talk. But for some other devices (as Samsung Galaxy S5 4.4.2, LG Nexus 5 Lollipop and Sony Z3 4.4.4) this solution does not work pretty charm, because rarely the audio goes through SmartBand Talk, speaking almost 95% of time on the phone, instead of on paired Bluetooth device.

I would like to know if the device extension work properly with this scenario, where the audio will be sent to Bluetooth device, correctly paired with phone.

I'd like to know if it's possible to have something stable, working on every phone, or if it's not possible.

like image 521
filipe.costa01 Avatar asked Nov 09 '22 20:11

filipe.costa01


1 Answers

That code snippet looks almost correct. But it contains some unnecessary calls.

Although, setSpeakerphoneOn(false) call is advised in most sources for some smartphones. I found it unnecessary on Z3.

You can check linked article below. It shows how to use Audio on devices with HFP support. It was written for SmartEyeglass. But it should work same on SmartBand Talk.

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

like image 105
Ahmet Yildirim Avatar answered Jan 02 '23 14:01

Ahmet Yildirim