[Q] [QUESITON] How to route audio (Not BT or A2DP) from 14 and higher API? - Android Software/Hacking General [Developers Only]

I will quickly summarize.
Samsung Galaxy S3, when I run some app with the headphones plugged and for some reason, if the app freezes or any other issue. The phone thinks that it have the headphones plugged yet. Although it's been unplugged.
I am developing an app to fix this samsung firmware problem.
AudioManager returns me "true" with the function isWiredHeadsetOn, with or without the plugged headphones. My question is that since old api of android, setRouting or setWiredHeadset are deprecated, and I don't know can I change the value of isWiredHeadsetOn to returns me false.
I don't know if I explains me well.
Code:
AudioManager manager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
manager.setMode(AudioManager.MODE_NORMAL);
This setMode don't change the wiredheadset value.
Thanks for your advices.

Related

[Q] HELP! A2DP Toggle on Droid 2, 2011, NEW

So I recently got a jawbone era bluetooth headset, and UNLIKE the Droid 1, the Droid 2 (which is the only phone I have now) cannot handle a hard-wired i.e. 3.5mm connection through the headphone port AND an A2DP headset at the same time, or at least not very well...
The issue is this, I want (like I use to do with my Droid 1) to plug my phone, and thus the music player on it, into my car's speakers via the headphone jack and STILL have my bluetooth headset on. When I exit the car, it'd be nice if the phone would then play the music on the headset when the headphone jack's connection is unplugged, so that means not having to manually turn the "Media" support for the bluetooth headset on or off all the time, "Media" being the A2DP if I understand that correctly.
There use to be an app, or more precisely a widget for that, but went out of commission after the 1.6 OS was upgraded. I've rooted my phone and tried to get that app working, but no luck. I can get into the options, but not the widget itself.
So, oh talented developers and gurus, I'm hoping for a solution of some kind, and as far as I'm concerned, there are a few different possibilities...
1) Some kind hearted soul will update the A2DP toggle widget for 2.2 (soon perhaps?)
2) There might be some Music app or other app out there that will accomplish the same thing, either automatically (would be nice) or manually (not as nice, but acceptable).
3) There might be a ROM out there with Droid 1-like support for the automatic switching A2DP/headphone jack...
Basically, I'd like a one or two 'click' toggle for the bluetooth 'Media' (aka: A2DP), or an automatic solution.
Anyone have any ideas?

[Q] Use bluetooth headset mic instead of phone mic

I've searched around on the forums for an answer to this but could never find anything that seems to match up to my issue.
I have a A2DP enabled headset and want to use it with apps such as Team Speak 3 beta, Vent, and other apps. But for some reason although phone media happily plays over onto my headset. My phone continues to only use the mic built into the phone instead of the bluetooth headset mic.
Any apps designed to use the headset specifically work (ie. normal phone calls, skype, vlingo) but otherwise apps ignore the headset mic.
I already tried using apps like BT Mono and Super BT Mono Froyo but they seem to only pipe audio to the headset, but don't do anything at all with the headset mic.
Does anybody know how to get the headset mic to be selected by apps instead of just the built-in mic?
My device is a Sumsung Galaxy S II ( I9100 ). Both Stock and CyanogenMod Gingerbread
good good good
Still hoping someone may know how to get the Galaxy S II phone to use a bluetooth headset mic instead of the built-in mic on the phone.
I'm really stumped on how to do this.
I still haven't seemed to have any luck finding a way to forcefully map apps to use the headset mic. I'm beginning to wounder if it's possible with the Android OS.
I have the galaxy s2 as well and I've retired several different things and have been unsuccessful with anything I've tried so far... Really difficult to drive and use vent without a headset.
Yeah I'm wanting to do the same thing.. I don't spose you've found a way in the last couple of months? Surely it can be done - may need to get a dev to write something for it though..
Sorry Lilfellabob, still no luck. I find it odd it's so difficulty to remap audio settings.
Even in Ice Cream Sandwich I can't find a way.
The app would need to be written to accept it. Its not a matter of your phone. Its the apps. Think about it for a min. If it works on apps made to use it but another app doesn't work then where does the problem lay?
The thing is, typically other apps should be able to re-route the app to use the headset mic. Alike how there are apps that can force other apps to use bluetooth audio instead of the phone speaker, even if the phone/headset can't use a2dp.
Dav_Edward said:
The thing is, typically other apps should be able to re-route the app to use the headset mic. Alike how there are apps that can force other apps to use bluetooth audio instead of the phone speaker, even if the phone/headset can't use a2dp.
Click to expand...
Click to collapse
Only if the code is there for it to do it. If they don't code it in then it doesn't work.
I'm having a similar problem but slightly the opposite.
I pair my phone to a Bluetooth device that lets me hear phone output on my car's speakers. However, the phone tries to use Bluetooth for the microphone when none exists. I want to force it to use the on-phone microphone. I can talk and talk but no one can hear me, unless I set the phone output to speaker or handset, which implies setting the phone input to amplified built-in mic, or just built-in mic, respectively.
In the Bluetooth settings I can set to use the Bluetooth device for music or phone, but ideally I would want "Phone" to be separated into "Phone output" and "Phone input" so I could uncheck input (and thus use the built-in mic.) This should be implemented at the Android level so that the setting can apply to all apps.
The same problem occured when I wired (2-stripe phone-to-car audio only, no mic) my Palm Pre directly to my car. I just tried with my GNex and it was smart enough to use the built-in mic when a microphone-less plug was connected.
zelendel said:
Only if the code is there for it to do it. If they don't code it in then it doesn't work.
Click to expand...
Click to collapse
wrong. its in the kernel. the new firmware on the android is is capable to transmit Audio Steam to Headset device as Audio only. i wont go 100% against coding to force it to but if they wanted to theres have to be some kind of exploit to do so. lets say if skype were to find that exploit or code it, it would be probably violate android policy.
HtcEvo4gLTE said:
wrong. its in the kernel. the new firmware on the android is is capable to transmit Audio Steam to Headset device as Audio only. i wont go 100% against coding to force it to but if they wanted to theres have to be some kind of exploit to do so. lets say if skype were to find that exploit or code it, it would be probably violate android policy.
Click to expand...
Click to collapse
Actually, what's going on is Skype is using the 'bluetooth device' hook of some sort, just like other apps that support piping audio to the bluetooth headset. However most apps don't use the bluetooth device API/hook and just dumbly send their audio to 'default output device' and 'default input device' blindly and let the OS or Kernel decide where to send it.
The OS or Kernel when it senses a bluetooth device with the 'media' profile on it is present, it changes the default output device to the headset, but it doesn't seem to bother doing the same for the bluetooth mic for the default input device.
Because apps like Teamspeak 3 just blindly use default audio device because it doesn't use bluetooth APIs in the app itself, I have no way to make it use the headset mic.
I wish someone could make a mod or app that will allow mapping the default input to a bluetooth mic when present.
As far as I know, Skype has problems using the BT mike as well. In fact, they took a user survey regarding the issue for android and iOS users. However, I cannot find the results of that survey / study, and Skype recommendations thereof.
User choice to use BT mike seems so BASIC to me, I wonder how it was overlooked...!
Rooting will crack open the full power of your Android device!
Dav_Edward said:
Sorry Lilfellabob, still no luck. I find it odd it's so difficulty to remap audio settings.
Even in Ice Cream Sandwich I can't find a way.
Click to expand...
Click to collapse
zelendel said:
The app would need to be written to accept it. Its not a matter of your phone. Its the apps. Think about it for a min. If it works on apps made to use it but another app doesn't work then where does the problem lay?
Click to expand...
Click to collapse
Rooting the device would give apps or the user permissions to modify system audio controller's (idk if it is anything like ALSA or anything..) settings to make app use the audio channel for the bluetooth headset... an example for the Galaxy s2 i9100 i have is the radio app "Sprit FM" has a "volume control stream" setting which allows the user to select what volume "control" will control the volume of the app's audio output
anywho... i hope it helps a little
rwong48, I have now the same problem that you have described. Have you solved it with any app for Andorid?
Thanks!
Solution
I found an app that solves this problem on android devices, it's called btmono and you can find it in the Google store. I tried to post the link but I don't have enough posts under my belt...
Anyways, pair your device, open the program (such as ts3), connect to your server and then turn on btmono. Voila!
Well, I tried to delete this after I saw that you had already tried btmono, but I couldn't figure out how so just disregard this message.
I already tried btmono, sadly although it works for the output audio, it does *not* work with the headset mic. Programs like TS3 will still keep using the phone's built-in mic, not the headset mine despite using btmono. The only thing btmono does is pipe the output audio to the headset only.
Thanks for the suggestion though
I can't believe they haven't fixed that yet. It is so basic...
Hey guys I'm going through the same issues with my note 2. Svoice was the only one that works but its painfully slow and inaccurate.
Anyways I've tried utter! robin and aivc. Aivc works pretty good but at least it uses the mic.
Utter is really promising but no Bluetooth mic. The devs have acknowledged it though. So hopefully soon.
Update: AIVC has one downfall. The app can't open if the screen is locked like utter and svoice can when prompted from bluetooth. Also, it only listens automatically the first time. If you close it without killing the app, you'll have to press the mic icon manually every time (which takes away from the purpose of handsfree).

Howto AutoUse BT Pair for Media Audio?

I've touched on this question before but I may have been using some wrong terminology.
On my S3 I have successfully created a BT pairing with a BT Audio Device use which has a steroe out fed into my car's head unit's Aux In.
So, it is Auto-Paired. That is, when I step into my car and turn on the ignition thus powering up the BT Audio Device the paring is available to be used for Media Audio.
However, in order for my phone to route audio to the BT Audio Device I must enter the phone's BT menu and tell the phone to connect to the Device for Media Audio.
I can either do this through the notification pane to see pairings then tap the pairing to use for Media Audio or I can go through settings->BT and do the same thing.
Either way, it's a huge PITA to do this every single time I get into my car.
There has got to be a way to have the phone automatically route Media Audio through this BT Audio Device upon detection. My previous two phones had nowhere near the ability of my S3 but they had no issues whatsoever with automatically pairing and routing audio to this BT Audio Device.
Is the S3 really this stunted in the BT department? If so, is there an app that fixes this stupidity with grace and non-intrusiveness?
crabapples said:
I've touched on this question before but I may have been using some wrong terminology.
On my S3 I have successfully created a BT pairing with a BT Audio Device use which has a steroe out fed into my car's head unit's Aux In.
So, it is Auto-Paired. That is, when I step into my car and turn on the ignition thus powering up the BT Audio Device the paring is available to be used for Media Audio.
However, in order for my phone to route audio to the BT Audio Device I must enter the phone's BT menu and tell the phone to connect to the Device for Media Audio.
I can either do this through the notification pane to see pairings then tap the pairing to use for Media Audio or I can go through settings->BT and do the same thing.
Either way, it's a huge PITA to do this every single time I get into my car.
There has got to be a way to have the phone automatically route Media Audio through this BT Audio Device upon detection. My previous two phones had nowhere near the ability of my S3 but they had no issues whatsoever with automatically pairing and routing audio to this BT Audio Device.
Is the S3 really this stunted in the BT department? If so, is there an app that fixes this stupidity with grace and non-intrusiveness?
Click to expand...
Click to collapse
I feel ya, in the past, all I had to do was toggle BT on and go, now there's two or three extra steps which almost defeats the use of a toggle.
I just started searching for some answers and am honestly surprised no one else has made a big deal about this. If I find something, I'll post it up... For now, going to take a look at some system files and build.prop stuff, but it's not really my department.
Got some NFC tags and NFC Task Launcher hoping I could circumvent the BS with a hardware hack. But no, the best this does is auto toggle the BT radio and open the device selection screen where 2 more taps are required to actually use the device for media audio. Any new insight out there? Considering Tasker app but it is rather expensive and no free version to see if it does the trick.
My Bluetooth Auto Corrects Just fine to my cars Bluetooth... Toggle on and go. Running AOKP currently but it worked properly on stock, stock rooted, and Synergy as well.
I haven't gotten a chance to try this yet but I probably will tomorrow.
Tasker forum post indicating the problem is well known, prevalent and hardly any fixes exist:
https://groups.google.com/forum/?fromgroups=#!searchin/tasker/bluetooth$20audio/tasker/TLsjT9Exle8/ZLlgvEn5vUUJ
An app that forces the connection amongst other things:
https://play.google.com/store/apps/details?id=a2dp.Vol
A Tasker plugin leveraging the force connect code which happens to be GPL'd in case any of our fine developers would like to start making ROMs that address this major drawback of using a S3:
http://code.google.com/p/a2dp-connect/
crabapples said:
I haven't gotten a chance to try this yet but I probably will tomorrow.
Tasker forum post indicating the problem is well known, prevalent and hardly any fixes exist:
https://groups.google.com/forum/?fromgroups=#!searchin/tasker/bluetooth$20audio/tasker/TLsjT9Exle8/ZLlgvEn5vUUJ
An app that forces the connection amongst other things:
https://play.google.com/store/apps/details?id=a2dp.Vol
A Tasker plugin leveraging the force connect code which happens to be GPL'd in case any of our fine developers would like to start making ROMs that address this major drawback of using a S3:
http://code.google.com/p/a2dp-connect/
Click to expand...
Click to collapse
I haven't had any trouble with bluetooth devices reconnecting to my phone as soon as I power them on. I'm running cyanogenmod 10 rom.
Also you can get free trial of tasker from here tasker.dinglisch.net/download.html
zxsix said:
I haven't had any trouble with bluetooth devices reconnecting to my phone as soon as I power them on. I'm running cyanogenmod 10 rom.
Click to expand...
Click to collapse
It seems the issue may be primarily with BT Audio Gateways. I don't have this issue with my laptop at all and I'm imagining car head units rarely see this problem.
That said A2DP Volume App fixed this issue for me. Once configured I did have to manually set the device to use media audio one last time before A2DP Volume started doing it for me. I configured NFC Task Launcher to kill wifi, enable BT and launch A2DP volume when it contacts the tag in my car and it works perfectly. Since NFC Task Launcher front ends into Tasker and Tasker has the A2DP force connect plugin available I'm seriously considering getting Tasker for all the other cool features it can do besides scratching this particular itch.
crabapples said:
I've touched on this question before but I may have been using some wrong terminology.
On my S3 I have successfully created a BT pairing with a BT Audio Device use which has a steroe out fed into my car's head unit's Aux In.
So, it is Auto-Paired. That is, when I step into my car and turn on the ignition thus powering up the BT Audio Device the paring is available to be used for Media Audio.
However, in order for my phone to route audio to the BT Audio Device I must enter the phone's BT menu and tell the phone to connect to the Device for Media Audio.
I can either do this through the notification pane to see pairings then tap the pairing to use for Media Audio or I can go through settings->BT and do the same thing.
Either way, it's a huge PITA to do this every single time I get into my car.
There has got to be a way to have the phone automatically route Media Audio through this BT Audio Device upon detection. My previous two phones had nowhere near the ability of my S3 but they had no issues whatsoever with automatically pairing and routing audio to this BT Audio Device.
Is the S3 really this stunted in the BT department? If so, is there an app that fixes this stupidity with grace and non-intrusiveness?
Click to expand...
Click to collapse
You can fix this relatively easy by getting the app Tasker. I use it to do things like automatically start the music player I want when headphones are plugged in, to turning up the brightness automatically when I am getting an incoming call, etc. I am fairly certain you could set up the program to do whatever you want via bluetooth if you fiddle with it.
Gluck!
mdt73 said:
You can fix this relatively easy by getting the app Tasker. I use it to do things like automatically start the music player I want when headphones are plugged in, to turning up the brightness automatically when I am getting an incoming call, etc. I am fairly certain you could set up the program to do whatever you want via bluetooth if you fiddle with it.
Gluck!
Click to expand...
Click to collapse
LOL, if you had only read the rest of the thread...
Yeah, Tasker cannot do this OTB but with the A2DP Connect Plugin it can. Or you can just run the A2DP Volume app and do the same for free.
That the A2DP Connect code is GPL it would be super sweet if our developers incorporated the magic into the ROMs so that a base install didn't need apps to do something so simple as automatically route media audio to BT gateways.
This happens to me when I use the wrong settings in my cars head unit. My Toyota gives me the option to pair as a multimedia device, a phone or both. If you set it up as just a multimedia device then you won't have some functionality. Check your head unit manual and try to re-pair. You might have to delete the existing pairing for it to work right.
rfmodeler said:
This happens to me when I use the wrong settings in my cars head unit. My Toyota gives me the option to pair as a multimedia device, a phone or both. If you set it up as just a multimedia device then you won't have some functionality. Check your head unit manual and try to re-pair. You might have to delete the existing pairing for it to work right.
Click to expand...
Click to collapse
Yeah, it's not a head unit, it's an audio gateway that basically is just a BT receiver with a stereo out and no interface so it is what it is with no configuration options. This issue with the S3 appears to be primarily related to these types of devices.
crabapples said:
Yeah, it's not a head unit, it's an audio gateway that basically is just a BT receiver with a stereo out and no interface so it is what it is with no configuration options. This issue with the S3 appears to be primarily related to these types of devices.
Click to expand...
Click to collapse
Oh okay. When I look under the bluetooth menu in CM10 I have a paired connection that I named Car Multi-Media and if I look at its settings I see profiles called Phone audio and Media audio. I'm guessing you just have a Media audio profile. Not sure how to help you there. Sorry.

[Q] Force phone audio to phone earpiece when connected to Bluetooth device.

Hi, I recently flashed my phone (Galaxy Note 3) with CM 11 and my Galaxy Gear with null_23.
I connected the two of them via Bluetooth and everything seemed to work perfectly, until someone called me...
That was when I noticed that my phone forwards my audio to my gear speakers as it counts equivalently to any bluetooth earpiece. I tried unchecking Phone audio profile in bluetoth device settings but that completely disconnects my gear. (I should probably also mention the reason I want them connected is cause I'm using Bluetooth tethering for internet access on my gear).
I tried using an app I found called SoundAbout that forced audio device but it did so by (unchecking phone audio profile?) disconnecting the gear entirely.. which is not preferable.
I have been trying to search around for any info on how to do this, but all I've ever found has been to do the opposite, force bluetooth over other outputs.
Currently I have to change the output manually every time I answer/call someone, which takes a few sec where the other party wonders why I'm not responding..
I thought I would be able to change default phone audio output in my phone app or something, but no, no such setting is available.. its frustrating to be stuck with so little customisation even after invreasing it with a custom ROM... dang..
Thanks for any help!

LG CM2440 audio over USB AOA2.0 plays only one minute

I have a LG CM2440 micro hifi system that can play audio from an Android phone over USB using AOA2.0. I'm trying to use this feature and it plays fine but only 1 or 2 minutes and then goes silent. On the phone the app playing somehow freezes for a while and then continues without audio until USB is unplugged or playback paused and resumed. Anyone had a similar issue? I tested two phones and both behave the same so I belive it is the hifi system. I see nothing to tweak in regards to AOA2.0 in the hifi system or in the phones. Is there some secret menu that would allow to tweak AOA2.0?
Thank you!
Sounds like power management is shutting it down. Not sure what LG is using globally for that. Start there and make sure the app(s) battery setting is set to allow background usage.
I don't let it sleep and it plays fine when not plugged to USB. I think not likely to be power management.
Is there some way to test the AOA USB audio besides the hifi system? Some way to have a PC behave like an audio endpoint?
NixieJP said:
I don't let it sleep and it plays fine when not plugged to USB. I think not likely to be power management.
Is there some way to test the AOA USB audio besides the hifi system? Some way to have a PC behave like an audio endpoint?
Click to expand...
Click to collapse
I doubt it's hardware unless the DAC you're using is incompatible or defective. You can transfer large folders to the PC? Either a settings or firmware issue, more likely settings.
Maybe a bad 3rd party app. May have altered hidden user settings even if it was uninstalled.
You want verification? Factory reset would rule out a settings issue including hidden settings.
However if you don't find the root cause (and avoid it) it likely will reoccur.
Play with it. Google search for others with the same issue, doesn't necessarily have to be the same model or OS version.
Thank you for suggesting!
Yes, I tried that, phone freshly reset behaves the same. Two different phones behave the same. I googled but find nothing relevant.
The USB connection remains operative because even when the audio fails the player still responds to the hifi buttons (play, stop... the player in the phone can be controlled by the buttons in the hifi system).
I opened the hifi system to see the route of the signal, the USB plug goes to a BX8805 IC that looks like an ARM processor and it outputs a PWM signal to the amplifier. Nothing to do there, likely a firmware issue. Maybe I could try some ADB debug but not sure how could I attach the phone USB to a PC and the hifi system at the same time.
USB playback apparently not fixable so I will stick with bluetooth playback (it seems to me that USB playback sounds better).
For future reference after some investigation I found the following "LG bluetooth remote" app that works properly. This app allows control of the hifi system from the phone.
Free download btc 4 APK for Android
Download free LG Bluetooth Remote 4 1.3 for your Android phone or tablet, file size: 7.35 MB, was updated 2017/30/06 Requirements:android: 2.3.3 Gingerbread or above
apk.house
File name: LG_Bluetooth_Remote_4-1.3.apk
It is no longer available on google play but can be downloaded and installed enabling external sources. All functions that are supposed to work do work!
On Google play there is a LG XBOOM app that does not work very well with this hifi. Volume control broken (goes to MAX), missing equalizer option and hangs when CD or USB functions selected.

Categories

Resources