[Q] Choosing microphone source (internal/external from headset) programmatically - Android Q&A, Help & Troubleshooting

Hi everyone,
I fear I already know the answer but need to make sure about it.
Is there a way to choose between internal and external microphone source programmatically. We think about an app that constantly analyzes sound in the background. However, this scenario has a major drawback: once a headset w/ microphone is plugged in, we no longer receive data from the internal microphone. So is there any way to work around this? Maybe by using the NDK (no experience so far)?
Please tell me we are missing something here
Thanks in advance

If you're using the default MediaRecorder facility you can set it with the setAudioSource method. However, documentation doesn't specify what happens if you connect an external mic. More info here:
http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html

Thanks, but that doesn't really work for us since we are using AudioRecord instead of MediaRecorder. And from what I've learned setAudioSource lets you specify microphone in general, not the particular one

Old Thread about internal microphone problem.
knox420 said:
Hi everyone,
I fear I already know the answer but need to make sure about it.
Is there a way to choose between internal and external microphone source programmatically. We think about an app that constantly analyzes sound in the background. However, this scenario has a major drawback: once a headset w/ microphone is plugged in, we no longer receive data from the internal microphone. So is there any way to work around this? Maybe by using the NDK (no experience so far)?
Please tell me we are missing something here
Thanks in advance
Click to expand...
Click to collapse
Very old thread not sure if anybody still active on this one but did you ever find out if it was possible?

Related

Please don't stone me but is this possible?!?!

I was wondering is possible to create a program which mimics a normal phones volume on the speaker phone mode on this device? It would allow the user to use the speaker phone however make the speaker level so low that it would be usable as normal phone. If it can't be done oh well but it was just a thought. I am sure there has to be a simple reg which can be put together to achieve this. I figure if anyone can do this it would be you guys. I do not yet have this device however look forward to receiving it. (I like to have a folder with all my programs pre loaded).
Good idea, using headphones is not always an option...

How can I forward an voice call to another android device via bluetooth?

What I want to do is to write an app that forward the phone call from my android callphone to another android device, via bluetooth. Note that the destination is another android device, which could be another phone, or, in my case, is my x86 netbook with android installed.
The question may sound goofy. After all, if bluetooth is effective then the two devices must be close to each other. If both of them are phones, as most people would think, then what is the point to simply forward the call from one phone to another?
Well, in my case, the second device is not a phone, but an android device that are not capable making a phone call, which is an x86 netbook on which I have installed android. I wonder if I can write an app, and install it on both phone and netbook, such that I can directly make/receive the phone call from the netbook.
I have checked out the bluetooth chat sample code but apparently it can only send a string (byte[] buffer) over bluetooth, but not an audio stream that I need. I glimpsed the android bluetooth api but didn't find anything helpful.
Any suggestions or hints are greatly appreciated. Or if there is any existing discussion or source code to fulfill this purpose, please let me know. I did do some google search but found nothing.
Thanks.
Lik
lik88888 said:
What I want to do is to write an app that forward the phone call from my android callphone to another android device, via bluetooth. Note that the destination is another android device, which could be another phone, or, in my case, is my x86 netbook with android installed.
The question may sound goofy. After all, if bluetooth is effective then the two devices must be close to each other. If both of them are phones, as most people would think, then what is the point to simply forward the call from one phone to another?
Well, in my case, the second device is not a phone, but an android device that are not capable making a phone call, which is an x86 netbook on which I have installed android. I wonder if I can write an app, and install it on both phone and netbook, such that I can directly make/receive the phone call from the netbook.
I have checked out the bluetooth chat sample code but apparently it can only send a string (byte[] buffer) over bluetooth, but not an audio stream that I need. I glimpsed the android bluetooth api but didn't find anything helpful.
Any suggestions or hints are greatly appreciated. Or if there is any existing discussion or source code to fulfill this purpose, please let me know. I did do some google search but found nothing.
Thanks.
Lik
Click to expand...
Click to collapse
Bump
Or something that makes me dial from Device 1 but the calls are made on Device 2

[Q] Enabling phone on Jetstream - S-OFF issue?

Hi all,
I recently acquired a Jetstream in the US (AT&T) to bring back to France.
I'm pretty new to Android but I got the bootloader unlocked through htcdev.com, then managed to apply DoomLoRD's root and CWM recovery succesfully (excellent tutorial, BTW).
I now want to unlock the phone and reconfigure BT so I can use my regular BT headset (Nokia BH-109, supports HFP & HSP but no A2DP) following the instructions on http://forum.xda-developers.com/showthread.php?t=1418235, but that fails to work as the /system/build.prop file remains read-only.
Is there anything I've missed? Would that be because my Jetstream is still S-ON?
thanks in advance for any hint that gets me going!
François
Hi,
Welcome to the Jetstream community.
1st off, for you to be able to edit the /system/build.prop file, you need Root Explorer, navigate to the file, before opening it with the text editor, make sure to click on the R-W/R-R which you can find around the top left side of screen- it will basically change from read to write functionality in the system files. You will then be able to enable the options.
2nd, after following the steps, you will be able to get the phone app to show and you will be able to use MMI codes of the *123# sort perfectly. Coming to the call however, you will be able to make calls but no sound on either side of the calls. Still some bugs to be figured out and fixed. Some have got some clue about how to solve it - mentioned in the post with the instructions.
3rd, after following those instructions, you will be able to send and receive messages using a 3rd part app like GO SMS. Works perfectly well.
4th, the S-ON to S-OFF transition needs a lot of help from developers which is not happening as of yet. Hoping that someone will be able to really achieve this for us. It has been done for many other devices as well and we all here hope it will happen for the Jetstream too.
Hope it helps you and hope to have more people join the community of this wonderful device like you have just joined us and get this device moving soon.
-Kaialsh.
Hi Kaialsh,
thanks for taking the time to share your experience. I will look into Root Explorer for sure, even though I actually managed to answer my question when writing my original post got me thinking.
I'll write down what I found as it may be of help to others.
As I understood the problem was with the /system partition being mounted R/O I looked on the Market and found mount /system (rw/ro) and it seemed to work giving me a successful status, but the build.prop file remained R/O in vi, and Astro would not save it properly.
I then saw that DoomLoRD's custom kernel included R/W system partition and looking into that I found the adb remount command which did what I wanted, except it failed on my system.
Last bit was to boot the tablet into DoomLoRD's insecure kernel image (as I did before to root the Jetstream), then issue "adb remount", then edit build.prop and reboot again.
As you can see, it's not really straightforward and I wish I saw your post before all of this!
I did see the Audio problems with making calls and will be following the forum for a potential fix to this problem, but I have another issue right now...
Noise cancellation does not work at all and any attempt to make a VoIP call (SIP or Google Talk for instance) results in terrible echo at the other end of the line. The only way out is to use a headset and Bluetooth seems a reasonable choice.
Before the build.prop change, my Nokia headset (with HFP and HSP) would be detected and paired but would remain disconnected and no profile was listed (only options are to delete pairing or rename device). A set of Bluetooth headphones with A2DP support worked fine.
After the change, the device is paired and the headset profile listed as expected, but it still remains disconnected even though when I select it I get a "connected" popup. Of course, the headset will not give audio in any application, and the speaker works normally.
I'd be interested if someone around here has any hints into getting a regular cell phone Bluetooth headset to work with the Jetstream, as well as maybe a fix on the echo cancellation problem.
In any case, this forum is a goldmine
I too face the problem with google talk and sort-noise cancellation is bad. I however circumvented the problem by using a wired headset-no echo with that but the gain on audio was a bit low. I don't own a Bluetooth device myself to check and am kind of busy studying for exams go out and get myself one.
However, the basic problem seems to lie in the Mic settings and as mentioned in the section on enabling gsm calls, we need to check the codec files and anything related to Mic and htc audio libs. I did sit once checking for any potential files that contain details regarding this, but I was dumb enough not to note things down then and there so don't remember very well and haven't found the time to check it again. Will do so the earliest possible and share my findings. There was something about a particular file missing in the devices lost which seemed to be necessary for phone functionality.
Also, just out of curiosity, what is your main application with the Jetstream?
Sent from my HTC PG09410 using XDA
It's a shame I don't know enough about the platform to look into it myself, but I'm ready to try out any suggestion that comes forward!
What I intend to use the tablet for is remote desktop/VNC access to remote systems through ssh tunnels and voice/video conferencing, but at the moment I'm still in the discovery stages.
François
Cool. Welcome aboard once again.
Sent from my HTC PG09410 using XDA

[Q] Edit App to connect Bluetooth instead of USB

Needing some advice.....
I have an app that I'm wanting to use (Reads car protocols to control tablet). Presently, this app relies on the data being transfered via USB into the tablet. I'm wanting to either add or replace this connection method to allow for Bluetooth. I assume I'm only needing to change this connection method within the app's resources, manifest and XML files - needs to point to the Bluetooth socket, instead of the USB socket.
I'm not a developer, but feel I can edit this if I know what to edit. Can anyone provide any insight on the best way to accomplish this? Currently, I connect to the OBDII Bluetooth device and run Torque. So, the connection will already be present with the device, just need the separate app (Steering Controls) to read the data coming into the tablet via Bluetooth for specific information that triggers the app to do what it's designed to do.
Any help on this is greatly appreciated! If easier, I'm happy to provide the apk, or specific files within the app for someone to modify (maybe easier than trying to explain it to me).
Thanks in advance!!!!!
arshull said:
Needing some advice.....
I have an app that I'm wanting to use (Reads car protocols to control tablet). Presently, this app relies on the data being transfered via USB into the tablet. I'm wanting to either add or replace this connection method to allow for Bluetooth. I assume I'm only needing to change this connection method within the app's resources, manifest and XML files - needs to point to the Bluetooth socket, instead of the USB socket.
I'm not a developer, but feel I can edit this if I know what to edit. Can anyone provide any insight on the best way to accomplish this? Currently, I connect to the OBDII Bluetooth device and run Torque. So, the connection will already be present with the device, just need the separate app (Steering Controls) to read the data coming into the tablet via Bluetooth for specific information that triggers the app to do what it's designed to do.
Any help on this is greatly appreciated! If easier, I'm happy to provide the apk, or specific files within the app for someone to modify (maybe easier than trying to explain it to me).
Thanks in advance!!!!!
Click to expand...
Click to collapse
Also, I believe most of the code is there already; at least very similar. So it may just be as simple as entering the bluetooth socket and port information.
Sent from my SGH-I747 using xda app-developers app

HTC Desire S HTC Test Menu with Carbon installed - Test Menu code not working?

Hey XDA forum,
I've recently rooted my HTC Desire S phone and installed this version of Carbon on it
http://forum.xda-developers.com/showthread.php?t=2500130
so that I now have Android version 4.3.2 installed. However, I noticed I didn't have the normal Voice Recorder app present on my phone and since one of my primary uses of my mobile phones is that I want to record my voice for music ideas, I need a voice recorder.
So I started looking around on the Google Play Store for the Voice Recorder app that normally comes built-in with your phone. For some reason, it's not present. Anyway, downloading other voice recording software like
RecForgeII or Audio Evolution Mobile Studio (DEMO version in my case), I found out my microphone now has terrible noise being throughput in total silence. Additionally, whenever I speak, the audio level is insanely high and there's distortion and clipping coming in even from a meter away.
So I assume the microphone gain has been set to a too high level.
I figure I need to go into Android Engineer Mode and adjust the microphone settings. After doing a search on the net, I found out I could access the Android Engineer Mode by dialing
*#*#3424#*#*
Now, as soon as I type the closing *, the whole code disappears. However, no HTC Test menu is opened.
How do I access the menu?
Is there another way to adjust microphone gain?
Have others had similar problems after rooting and installing custom ROMs?
Thanks for your help,
Shrooblord
Additionally, I just made a call with my girlfriend and she let me know that in calling, my microphone shows the same behaviour: I sounded distorted and loud and we could only talk normally when I put my phone a meter away from my mouth and used headphones to listen.
I could really use your android expertise on this one, folks.
Work-around
I've ended up not doing this through the Engineer Mode nor with the installation of Carbon.
To fix this, I decided to move away from Clockwork Recovery Mod in favour of TWRP so that I could install Cyanogenmod 12 on my HTC Desire S. After a series of unfortunate events including bricking and successively un-bricking my phone (that took a long time to figure out haha), I've completely installed and personalised my new Android device (it really feels like it's a whole new phone - it's just in an old shell ) and am now running smoothly on Android version 5.1. It also automatically seems to have fixed my mic problem (which I hoped it would). Yay!
But I couldn't have done it if it weren't for this forum and many other resources like this out there on the web. My advice to you when hacking your phone to root it or to install a custom ROM or to fix microphone issues is to look around and not give up searching. It took me a grand total of what I estimate is around 40-50 hours from knowing nothing about custom ROMs and rooting and the like to getting a decent understanding of what steps to perform, how to perform them and more importantly, why. So keep looking. The answer's out there!
And if you can't figure it out today, go to bed and look at it tomorrow. I can tell you, there's nothing quite like approaching a problem with a head full of fresh ideas after a good night's rest.
Good luck out there.
If you've got problems, I'll do my best to keep an eye out on this thread and see if I can help you out.
Shrooblord

Categories

Resources