有没有从它的URI启动Spotify Track?
我尝试了以下方法,但是没有一个可以工作.当Spotify打开时,它始终位于播放列表页面,而不是轨道的播放器.
String spotifyTrackURI = "spotify:track:1cC9YJ8sQjC0T5H1fXMUT2"; Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("com.spotify.mobile.android.ui"); // I've tried with Intent#putExtra().. launchIntent.putExtra( SearchManager.QUERY,spotifyTrackURI ); // or with setData launchIntent.setData(Uri.parse(spotifyTrackURI)) context.startActivity(launchIntent);
谢谢
解决方法
在Freenode(irc)的#spotify频道上找到答案.感谢大家!
我把它放在这里供别人知道:
// right click on a track in Spotify to get the URI,or use the Web API. String uri = "spotify:track:<spotify uri>"; Intent launcher = new Intent( Intent.ACTION_VIEW,Uri.parse(uri) ); startActivity(launcher);