我的工作,需要知道什么音乐用户正在收听到的应用程序。结果对于默认的音乐播放器,我可以听的 com.android.music.metachanged
广播知道哪些正在播放的歌曲。
I am working on an app that needs to know what music the user is listening to.
For the default music player, I can listen for the com.android.music.metachanged
broadcast to know which songs are being played.
我发现在Spotify应用的设置选项,允许设备广播的状态。不过,即使我打开这个选项,我没有得到任何音乐信息时,歌曲在Spotify的无论从 com.android.music.metachanged
或播放的 com.spotify.mobile.android.metadatachanged
意图过滤器。
I found the option in the settings of the Spotify app to allow Device Broadcast Status. However, even if I turn on this option, I do not get any music information when songs are played in Spotify from either the com.android.music.metachanged
or the com.spotify.mobile.android.metadatachanged
intent filters.
这工作使用前的 com.spotify.mobile.android.metadatachanged
,但最近已停止工作。
This worked before using the com.spotify.mobile.android.metadatachanged
, but recently has stopped working.
我使用了错误的意图过滤器还是有不同的问题?
Am I using the wrong intent filter or is there a different problem?
刚走固定此我自己,我怀疑你会发现它是由于包名称的改变 - Spotify的最近改变了应用程序因安全漏洞,因此所有的意图是现在不同了。
Having just fixed this myself, I suspect you'll find it's due to the change in the package name - Spotify recently changed the app due to a security flaw, and so all the intents are now different.
替换 com.spotify.mobile.android 是 com.spotify.music 在你的意图,你应该是好去。
Replace com.spotify.mobile.android with com.spotify.music in your intents and you should be good to go.