我正试图通过另一个应用程序恢复在spotify上播放暂停的歌曲。
我目前的代码:
Log.v(TAG, "Resuming Spotify");
Intent playSpotify = new Intent("com.spotify.mobile.android.ui.widget.PLAY");
playSpotify.setPackage("com.spotify.music");
context.sendBroadcast(playSpotify);
这不起作用。然而,它会暂停正在播放的歌曲。
任何建议/资源表示赞赏!
com.spotify.mobile.android.ui.widget.PLAY
不再起作用了。使用
com.spotify.mobile.android.ui.widget.NEXT
Intent playSpotify = new Intent("com.spotify.mobile.android.ui.widget.NEXT");
playSpotify.setPackage("com.spotify.music");
sendBroadcast(playSpotify);
playSpotify = new Intent("com.spotify.mobile.android.ui.widget.PREVIOUS");
playSpotify.setPackage("com.spotify.music");
sendBroadcast(playSpotify);
这可能是一种解决方法。
更新:使用SpotifyAppRemote.getPlayerApi().resume();
Docs here