开发者

Android - Get current track info at app startup

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜