I am developing an android app where i am trying to get currently played song from default music app and play and pause it depending upon some commands. PAUSE CMD should pause the song and PLAY CMD should play the same song. I tried looking for some of the solutions but did not got how to access the current song being played from default music app. Please help me out if anyone have tried something similar. Thanks
Asked
Active
Viewed 318 times
0
-
This was already discussed in a different forum in stack overflow, can you pl. take a look of this url http://stackoverflow.com/questions/10510292/track-info-of-currently-playing-music – shri May 12 '15 at 07:17
-
@shri: I tried this one but receiver (which will show toast) is not getting called even if I pause or play song playing in background. – user3339691 May 12 '15 at 21:28
-
@shri: Do that code gives all the details of the song played from default music app of HTC. I am using htc but I want a solution that works for all phones. Please help me out – user3339691 May 13 '15 at 22:48
-
In my case i was trying to follow the below suggestion i.e. tried to register for the action of the other players present in the device. and it worked for me. However you have to ensure that action added is correct. iF.addAction("com.android.music.metachanged"); iF.addAction("com.htc.music.metachanged"); – shri May 14 '15 at 10:46
-
@shri: I have added the actions correct but I think when I pause the song from the music app my current app gets paused and hence the receiver declared within the activity is not getting called. What do u think? – user3339691 May 14 '15 at 20:55
-
Where you able to receive in the onReceive method, intent.getData() when ever the track begins to play the data. In my case, i have only try to get the meta data of the playing track and not tried play or pause from my app. – shri May 15 '15 at 06:55
-
@shri: my onReceive() is not getting called. – user3339691 May 15 '15 at 22:26
-
May be It can't pause if music is playing in other music app. We need to use third party app like (ex. google music player) to provide control to play/pause. – shri May 18 '15 at 07:06