问题描述
我有一个链接到Soundcloud音轨的移动应用程序.在Android上,点击这些链接会弹出一个对话框,要求用户使用其浏览器或Soundcloud应用完成操作".
I have a mobile application that links to Soundcloud track. On Android, clicking on those links brings up a dialog asking the user to "Complete action using" their browser or the Soundcloud app.
是否有一种方法可以绕过此屏幕,而仅在Soundcloud播放器中播放曲目?
Is there a way to bypass this screen and just play the track in the Soundcloud player?
这是我当前使用的代码.请提出任何修改或新方法.
This is the code I currently using. Please suggest any modifications or new way to do this.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://m.soundcloud.com/blackburnravers/dj-nj-house-music-volume-3"));
startActivity(intent);
推荐答案
最后,我自己找到了解决方案.似乎没人知道这一点.通过使用以下代码段,您可以默认从Android应用程序打开声音云播放器.
Finally I found the solution by myself. Seems like nobody knows about this.By using the following code snippet, you can open the sound cloud player by default from your Android app.
String id = "114143409"; //Track id
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("soundcloud://tracks:" + id));
startActivity(intent);
重要提示:您必须在Android设备上安装声音云播放器.
Important : You have to have install the sound cloud player on your android device.
更新
Soundcloud社区严格建议使用声音
而不是 tracks
Soundcloud community is strictly recommending to use sounds
instead of tracks
String id = "114143409"; //Track id
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("soundcloud://sounds:" + id));
startActivity(intent);
这篇关于强制在Android的Soundcloud应用中打开Soundcloud轨道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!