Smartband Talk - Audio through it

I have been trying for several days to send Google Text-to-speech text messages via SmartBand Talk (SWR30). I have the correct permission on AndroidManifest.xml

PERMISSION_CONTROL_EXTENSION, BLUETOOTH_ADMIN, BLUTUS, MODIFY_AUDIO_SETTINGS, BROADCAST_STICKY

And I use this code to get AudioManager:

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

And using AudioManager to talk through SmartBand, we say this:

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

This solution works for some devices, which means that I can really hear the message through SmartBand Talk. But for some other devices (like Samsung Galaxy S5 4.4.2, LG Nexus 5 Lollipop and Sony Z3 4.4.4) this solution doesn’t work quite charming, because rarely the sound passes through SmartBand Talk, speaking almost 95% of the time on the phone, and not on the paired bluetooth device.

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

I would like to know if it is possible to have something stable, work on every phone or if it is not possible.

+5
source share
1 answer

This piece of code looks almost correct. But it contains some unnecessary challenges.

Although calling setSpeakerphoneOn (false) is recommended in most sources for some smartphones. I found this unnecessary on the Z3.

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

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

+1
source

Source: https://habr.com/ru/post/1211412/


All Articles