Hi, I have a question about Bluetooth profile - java

I'm making a speech recognize App.
But there is problem.
App have to listen user's voice, So Bluetooth profile change to sco.
But I want to change Bluetooth profile to A2dp when I listen the music.
The Service can close by AudioManager.isMusicActive() but it can't change back A2dp.
Is there answer for it? I know that 2 profile can't be incompatible.
So, When i use for speech recognize , Bluetooth profile -> Sco
When i listen to music, Bluetooth profile -> A2dp
How can i handle it?

Related

Can I listen to a Bluetooth data receipt on a broadcast receiver on android and if I can, how?

I'm trying to build a Bluetooth emergency beacon(a MCU hooked up to a Bluetooth module),which after I press a button sends some data to my android app on my phone. I want to listen to this data reception (even when the app is not in the foreground) and then do something in my app, like call 911. So what's the way to do that, if there's any.

How to hide Android Bluetooth App in Launcher without removing Bluetooth services?

I am trying to hide Android Bluetooth App from Launcher without removing Bluetooth services. I found some approaches to this but they also remove Bluetooth services. I just need to hide the Bluetooth app icon.
Here is the app source code:
https://android.googlesource.com/platform/packages/apps/Bluetooth/
Thanks.

Will I receive GCM messages if Android kill my app and if I do a Force Close from the settings?

I'm a newbie to Android development and I'm interested in two things which is connected to Google Cloud Messaging.
Does Android absolutely kill applications if they run for a long time in background as iOS does? And if so will I receive GCM notifications after my app was killed by Android?
Is there some difference between Force Close (from the settings menu) and when the app is killed by Android? And if I do Force Close will I receive GCM notifications?
1 - yes, but if you install in your manifest a broadcast receiver that listens for the gcm, it will triggered anyway. What you will do with that event depends on your app. A common practice is to start an intent service that handles the message. It's up to you to make interact with the activities of your app.
2 - From android 3.1, if the user force closes your app, it will stop to be notified of any broadcast until the user does not start your app again. Check "Launch controls on stopped applications" here for more details.

Disable Bluetooth sound output

I am writing an app which monitors the volume setting of the notification stream (using a broadcast receiver for android.media.VOLUME_CHANGED_ACTION - kind of a hack I know) and when it is set to silent I would like to stop my Bluetooth headset from ringing but without disconnecting it, so that if I choose to answer the call (it vibrates or I see it ringing) I can do so from my Bluetooth headset.
So far I've tried muting the voice stream, the Bluetooth stream (by providing the int 6), setting setBluetoothScoOn(false), using stopBluetoothSco() and muting the previously mentioned streams but nothing seems to work. I've got the modify audio permission so I'm beginning to think it isn't possible.
Does anyone have an idea?
When connected on bluetooth headset, call notifications are send using HFP protocol , this protocol only internally sends certain AT commands(phone to headset) which lets headset know about the call , settings SCO ON/OFF will turn call audio to headset/phone, ringing is internal to bluetooth headset

How can I use serial communication (port) via Android Bluetooth to send data?

How can I use serial communication (port) via Bluetooth to send data?
I need to send serial data through an Android device to a Bluetooth model (BlueSMiRF Silver) (that is connected to an Arduino board).
I was literally sitting for three day trying to understand how to do that...
Would be nice to have more details about what you tried and where you are stuck.
On the Android side the first step is to pair with the BlueSMiRF module. You should be able to discover the BlueSMiRF and pair from the "Bluetooth Settings" on android. You might have to put the BlueSMiRF module in discoverable mode (and you can set the a pin code for it).
Once paired, to be able to send and receive data you need to connect using a Bluetooth socket. To communicate with the BlueSMiRF module you need to use the Serial Port Profile (SPP) and create and RFCOMM socket. For an example you can have a look at this post.

Categories

Resources