Reputation: 321
I am using mediaplayer to make a small music player app with some limited controls as play, pause and stop. But its not acting as actual music player. Like once I got a phone call in between playing music but the music keeps on playing and its not what I need.
The thing I mean that the music playback is just limited to app itself and do not deal with any other app. Like I have musicmatch (App that loads lyrics) in my mobile and it do not loads the lyrics of song I am playing in my app while it perfectly loads for Google Play Music and many other apps! Also when I m playing songs in my app and go to any other player to play song, both songs got overlapped which doesn't happen with any other player except my own one! [my + Play Music = Overlapping but Samsung Music (currently playing) + Play Music(about to play) = Samsung Music Stops and Play music Starts]
Please tell if there are any certain properties to make my player very global so whole phone can access it and take actions as per music playback!
Any help will be much appreciated !!
Upvotes: 0
Views: 165
Reputation: 2611
It sounds like you are having issues with audio focus. That is why you are having issues with audio playing while on a call or while other players are in use. You should look into the AudioManager to help you with that. The developer site also has a training and guide regarding audio focus and media playback. You should be able to find the example source in /sample/android-21/legacy folder if you installed the samples.
As for your other issue. Other apps are not accessing the other music players. The other players are most likely broadcasting an intent with information about the song currently playing.
Upvotes: 1