views:

33

answers:

1

How can I get currently playing track info at app startup?

http://blog.dexetra.com/2010/09/get-current-playing-track-info-from.html has nice and working example on how to get info when android media player does some action (track is changed, finished, started etc). But when I launch my app I need to get currently (in the background) playing track info immediately and this example doesn't work for it (tried it with HTC Desire and Android 2.2).

Thanks

+1  A: 

I'm not sure exactly what to do, but I looked at the source for MediaPlaybackService and it seems like the interface contains a number of functions that get at what you are looking for. If you bind to the service, you can request things like the audio ID, artist name, track name, etc.

Here's an example that I found on code.google.com. Looks like it does what you wanted it to do.

Paul