Bluetooth speaker programming - android

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.

Related

Android use internal mic and bluetooth headset as speaker with high quality media protocol during calls

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

Making an android a a2dp sink, or a pass-though music player with bluetooth

So firstly, although this has been asked before, have there been any recent updates that allow you to change a device to an a2dp sink instead of source from the app level?
What I want, is to create an app that can be on two phones. One phone has music, and via bluetooth is streaming that to the phone, which in turn is sending that to a bluetooth speaker. To clarify, the second phone is not playing music, merely passing it on to the speaker.
Like this
|Device 1| --bluetooth music stream--> |Device 2| --> |Bluetooth speaker|
Does anyone have any ideas how this could be done?
Thank you.
In my opinion you cannot. To stream audio to Bluetooth device it should support A2DP profile. But none of the phones are designed with A2DP.

Turn off microphone in android

I want to turn off or disable the microphone during a call.
I searched, but I got almost nothing. Some people say it is not possible in android.
How do I turn off the microphone?
You can't completely disable the microphone. But you can play around the audio manager, to mute it etc...
AudioManager

Play a sound only using phone audio

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)

mute sound through phone speaker Android api

I want the to mute all sounds coming through the phone speaker but keep the sounds going through the headphones. Is this possible?
I was looking at:
setMicrophoneMute(true);
and
setSpeakerphoneOn(false);
but neither seem to have any affect. Is this even possible? I have this permission in my manifest:
I couldn't see any methods that would accomplish what I want in the audio manager but maybe I just don't understand the api.

Categories

Resources