我试图想象Shazam这样的应用程序是如何能够启动spotify来播放特定歌曲的.关于SO的另一个问题提出了一个意图String spotifyUri = "spotify:user:username" ,然后将其解析为a Uri,而不是搜索刚启动spotify的用户.如何让spotify播放曲目?
编辑
看看Logcat,Shazam看起来像这样:
Starting: Intent { act=android.media.action.MEDIA_PLAY_FROM_SEARCH cmp=com.spotify.mobile.android.ui/.Launcher (has extras) } from pid 9959
Run Code Online (Sandbox Code Playgroud)
我如何在我的代码中复制它?
编辑
好吧,显然它是这样的:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setAction(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH);
intent.setComponent(new ComponentName("com.spotify.mobile.android.ui", "com.spotify.mobile.android.ui.Launcher"));
Run Code Online (Sandbox Code Playgroud)
现在如何告诉它搜索特定歌曲?
| 归档时间: |
|
| 查看次数: |
3681 次 |
| 最近记录: |