dor*_*nad 11 android spotify android-intent
无论如何从它的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);
Run Code Online (Sandbox Code Playgroud)
谢谢
dor*_*nad 15
在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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10363 次 |
| 最近记录: |