I'm developing a sort of alarm clock application and I need to play my sound specifically through the phone audio and not through Bluetooth. (I learned this the hard way as I missed all three of my set alarms this morning because the alarms played through my Bluetooth headset)
How can I play a sound that only plays through phone audio and not Bluetooth?
I had similar requirement when user select an option, i need to play audio from speaker. so i changed audio stream type to ring like mp.setAudioStreamType(AudioManager.STREAM_RING) and it worked. Hope this works for you too. (NOTE: some phones have limitation that audio is played from both speaker and bluetooth)
Related
I have bluetooth earbuds with great sound quality and built-in microphones. In my android bluetooth device settings, I have to switches for media profiles: 'Call audio' and 'media audio'
Behavier with both activated:
when mic not needed: high quality sound protocol (1-directional, phone to headset)
when mic needed: switches to low quality sound protocol (2-directional, headset mic also streamed to phone)
Problem: I want better audio quality during calls, because I often am on long calls (mostly on discord) and I want to listen to music in the background with great quality.
Therefore I want to use the 1-directional great protocol and the internal built-in microphone
I did some testing using the audio recorder at first:
turned off 'Call audio' switch in bluetooth settings
earbuds not recognized as possible microphone
recording startet, music on earbuds paused, internal mic was being recorded, I could listen to music in great quality (had to hit play again) on my earbuds with great quality simultaneously -> perfect
So I thought I discoverd the solution, BUT:
On Discord (or any other call app) the earbuds did not show up as a possible speaker.
When listing to music on the earbuds and then joining a call, the audio output immediatly switched to the speaker/earpiece speaker (call audio and music). Probably because the call profile was disabled.
Does anyone have a solution/workaround?
sure, wired headphones would work
Maybe there is a way to redirect my call output from discord to a media stream and then into my earbuds (Then the voice quality on discord would not improve, but I could listen to music in high quality). I found an app (BTmono) doing basically the oppsite for headsets with a call profile only: It converts your media output into a mono stream and outputs it as call audio
maybe, I can somehow mark my earbud's media profile as a call profile too
or maybe anyone got some other workaround that did not come to my mind yet.
I would really appreciate a proper solution to my problem, thanks
I want to play a youtube video which should use bluetooth connected speaker as audio output. Same time I want to talk over phone which should use mobile's default speaker.
Is that possible?
i want to know if it is possible that when you connect to Bluetooth speaker by A2dp you can play your desired sound and other sound not be played like sounds of Sms,notification,...?
Well, the only possible way is for you to turn off all kinds of notification sounds and reactions on your device, otherwise it will interfere.
Take audio play in whatsapp as example, if your ear near the phone, the speaker will change to the earphone speaker, while the ear leave the phone, it use the audio speaker.
I am using the mediaplayer to play the audio file, and found that there is
setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
to switch the speaker to the ear speaker. and
setAudioStreamType(AudioManager.STREAM_MUSIC)
for default audio speaker.
The problem is , how to detect when the ear is near the phone, or is it necessary to implement by my program (should have some default android API for that ? )
Thanks a lot for helping
Most (or may be all?) android devices have proximity sensor. I think it is what you need.
Check this question and Android documentation on Sensor for more details.
when a voice call is established, I want to play audio in an stream so that the one at the other end of the call can hear the audio, but as it is mentioned in documents it is not possible.
so I decided to play that audio through the speakers with maximum volume so that the microphone can hear it (in general this a really ugly workaround but as it is going to be done in a special situation in my app, no problem!!!).
now the problem is this that when the call is established the system reduces the volume of my audio. how to solve it ?