Reputation: 77
I want to create an Android app, which can retrieve the information of music/song playing by other Android apps (no matter local file or streaming music).
I found the MediaMetadataRetriever class but it seems to me that it only supports to get music/song info I have specified by setDataSource. However, I won't be able to know the source in this case since the music/song is played by other apps.
If MediaMetadataRetriever is the only way to get media info, is there any way to get the data source information?
Any suggestions/hints are all appreciated!
Upvotes: 1
Views: 854
Reputation: 3530
MediaMetadataRetriever is used to retrieve metadata but not for files being played by other applications. If an application chooses to share information about what it is currently being playing it will usually do so by broadcasting an Intent. You can write a BroadcastReceiver to intercept this intent (assuming you know the intent filter) and then store this information. Note, not all applications will broadcast this information, the developer can choose not to implement this functionality.
Upvotes: 3