'Android - playback audio on internal phone speaker with bluetooth speaker connected
My setup: Android 4.4 tablet connected with Sony bluetooth speakers. Spotify is playing music on the bluetooth speaker.
Using
audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.setStreamVolume(AudioManager.STREAM_NOTIFICATION, audio.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION), 0);
soundPool = new SoundPool(20, AudioManager.STREAM_NOTIFICATION, 0);
SoundBeeps = soundPool.load(this,R.raw.beeps,1);
soundPool.play(SoundBeeps, 1, 1, 0, 0, 1);`
the notification sound is played back on both the internal and the bluetooth speaker.
Is it possible to play a notification sound only on the tablet's internal speaker, not on the bluetooth speaker?
Solution 1:[1]
soundPool = new SoundPool(20, AudioManager.STREAM_NOTIFICATION, 0);
the argument AudioManager.STREAM_NOTIFICATION here is responsibe to make it play in that manner
I have not tried this but type this AudioManager.STREAM_ and hit ctrl+space you will get recommendations and use each one and test
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Avinash Joshi |
