Reputation: 45
I have an Android app in which I want to set the media output to a specific device, in my case the phone's internal speakers, while being connected to a bluetooth device. For clarity, I don't want only my app to play through a specific output. I want the system media output to change.
Yes I saw: how to switch audio output programatically in android 10?. But using this method does not work.
What I am trying is using the audio manager to set the internal speaker for media:
AudioManager am = (AudioManager)GetSystemService(AudioService);
am.Mode = Mode.Normal;
am.StopBluetoothSco();
am.BluetoothScoOn = false;
am.SpeakerphoneOn = true;
In the manifest I have also put
When the code runs which is confirmed by the log in Visual studio it just doesn't work. In the media panel my bluetooth device is still selected. I also checked if it maybe did route the audio while not showing it, but it did just play on the bluetooth device.
Am I doing something wrong or is this even possible? Or do I have to use something completely different?
If useful my device is a Samsung A41 with Android 11. Using Visual studio Xamarin Android.
Upvotes: 4
Views: 2293