My app runs as a service in background and can give notifications based on some events. Currently, to play notification files, I use MediaPlayer in my app :
MediaPlayer mPlay = MediaPlayer.create(this, R.raw.sound);
mPlay.start();
But, if a song is already playing on the device (Music player, radio etc), and my notification plays when receiving the event, both the sounds (Music audio & notification audio) is heard in parallel.
So, is there a way that I can suppress the system audio volume so that my notification is heard clearly and once notification audio is over, the system audio can playback again?
Thanks for any help