Martin
Martin

Reputation: 21

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?

Upvotes: 1

Views: 1716

Answers (1)

Avinash Joshi
Avinash Joshi

Reputation: 1308

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

Upvotes: 1

Related Questions