Android: when implementing a music player in my app, can I make sure there is no other media playing playing music right now?

As of android 2.2 you can use AudioManager. RequestAudioFocus() other audio players should listen for this focus change request and can stop/pause/lower volume of their audio according to what type of audio your focus requests. However not all audio playing apps have bothered to implement this yet To be nice you should also listen for audio focus change requests from other apps and pause your apps audio accordingly On earlier versions of android calling mediaPlayer.

SetAudioStreamType(AudioManager. STREAM_MUSIC) will usually stop any other music from playing.

As of android 2.2 you can use AudioManager. RequestAudioFocus(), other audio players should listen for this focus change request and can stop/pause/lower volume of their audio according to what type of audio your focus requests. However not all audio playing apps have bothered to implement this yet.To be nice you should also listen for audio focus change requests from other apps and pause your apps audio accordingly.

On earlier versions of android calling mediaPlayer. SetAudioStreamType(AudioManager. STREAM_MUSIC); will usually stop any other music from playing.

– ekatz May 16 at 16:16 yes. Myself, I have just implemented the audio focus method as its quite easy to do and simply hope that in time most popular music players will implement it too – Chris. D May 19 at 12:14.

When click on that button, it'll check if music playing. If music playing, it'll stop that. How can I check if music playing?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions