Control android device volume using external headset or other connected device - android

Trying to make a simple application,in which after connecting android phone to bluetooth headset,when we press volume buttons on headset device it must change volume of android device.
So basically trying to control android device volume using bluetooth headsets.
Is there any way to do this ?
TIA

Related

Switching Bluetooth SCO (headset) device when multiple are connected

I'm working on getting bluetooth working in my app for VoIP calls, and I can get the headset connected and playing correctly.
I'm using a combination of listening for Bluetooth Headset changes as well as using the Bluetooth profile proxy to see which headsets are connected.
When I call get the proxy,
mBluetoothAdapter.getProfileProxy(context, pofileListener, BluetoothProfile.HEADSET)
https://developer.android.google.cn/reference/android/bluetooth/BluetoothAdapter#getProfileProxy(android.content.Context,%20android.bluetooth.BluetoothProfile.ServiceListener,%20int)
I get a list of the currently connected bluetooth headset devices, and it tells me which one is connected to Audio with a boolean flag
https://developer.android.google.cn/reference/android/bluetooth/BluetoothHeadset#isAudioConnected(android.bluetooth.BluetoothDevice)
I can't figure out how to change the audio source though? I want to show these two connected devices in a dialog and let the user choose between them.
I can physically turn one or the other device on/off and the audio transitions smoothly every time, I just want to let the user choose where the audio goes.

What is a proper way to route an audio from Android device to A2DP device

I'm new in android development, I'm developing a simple application that plays a music on button click through speaker , I would like to know how to route an audio to A2DP bluetooth device after paring with the A2DP device.
What are the configurations of AudioManager and other presets?
Thanks!

How to use Android device as a bluetooth headset for another mobile phone?

I want to make my android device working as a bluetooth headset.
I search the Android APIs, but I just find some interface which
can make Android device working as a masters, not as a device(bluetooth headset).
I'm also ready to modify the source codes of Android OS, and rebuild the OS.
What I hope is, when Android devices connect to a mobile phone with bluetooth, the Android devices can work as a bluetooth headset.
I don't know whether there are interfaces can do this, or I should modify the Android OS?
Thank you!
You need to implement HFP profile in your android device, normally phone role is AG(Audio gateway) and headset roles is HF(Hands free) , think its as a server and client role. Connect RFCOMM channel to phone using UUID defined for HF , have SDP record updated,changes will be required to handle AT Commands as well.
These will be the initial changes, once done you will need to handle audio packets(SCO packets) for voice calls

Android bluetooth programming: Sending event/data from Bluetooth headset to Android Phone via bluetooth.

As part of one of my course project, i want to initiate/trigger my own android app through the bluetooth headset or any such bluetooth device by pressing the available button on them. I will press any specific button on my bluetooth headset and my application should be able to detect that button press event and start its execution automatically.
Just read http://developer.android.com/guide/topics/connectivity/bluetooth.html. You need to create a listening bluetooth server on you'r phone, read Connecting as a server and Working with Profiles.

How to force a connection to a a2dp bluetooth device by an activity or service

I'm using my Nexus One with Android 2.2 Froyo in my car dock. For the audio output I'm using a a2dp receiver which is hooked up to my car stereo.
Now, when I put the phone in the car dock it automatically connects to the car dock but not to my a2dp receiver, I have connect it manually in the settings (already paired).
I'm also using a custom app for audio playback. I thougt I maybe could force the a2dp connection to the a2dp receiver. But as far as I know, the default Bluetooth API does not support such a thing.
Is there any Intent for establishing the connection, or any other way? I would also accept an undocumented solution.
I fixed this recently with the app A2DP volume.
My issue was my lg p920 on android 2.3.5 would connect to handsfree and a2dp stereo audio with my Sony car stereo mex bt3950ou (many other brands have the same issue).
Once the car was turned off and back on again ie. in turning the ignition from acc to start, the connection would be lost and only the handsfree would reconnect.
A2DP volume can be configured to force reconnect the stereo audio connection, see instructions on the A2DP volume site.
See your issue with twin BT devices. You can get BT Visor mount systems that do this. The BB version will stream A2DP music from the device AND allow you to take calls. The drawback is it uses FM to get the sound to your headunit so sound quality will be lower than native BT.
The technique is demonstrated in this app: http://code.google.com/p/a2dpvolume/A2DP Volume
Look at service.java and the IADL file.

Categories

Resources