android – 从Spotify意图开始一首歌曲

有没有从它的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);

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...