1
votes

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?

1

1 Answers

1
votes
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