编程语言
首页 > 编程语言> > 强制Soundcloud轨道在Android上的Soundcloud应用程序中打开

强制Soundcloud轨道在Android上的Soundcloud应用程序中打开

作者:互联网

我有一个链接到Soundcloud轨道的移动应用程序.在Android上,单击这些链接会弹出一个对话框,要求用户使用他们的浏览器或Soundcloud应用程序“完成操作”.

有没有办法绕过这个屏幕,只是在Soundcloud播放器中播放曲目?

这是我目前使用的代码.请建议任何修改或新方法来执行此操作.

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://m.soundcloud.com/blackburnravers/dj-nj-house-music-volume-3"));
    startActivity(intent);

解决方法:

最后我自己找到了解决方案.似乎没有人知道这一点.
通过使用以下代码段,您可以默认从Android应用程序打开声音云播放器.

String id = "114143409"; //Track id
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("soundcloud://tracks:" + id));
startActivity(intent);

重要提示:您必须在Android设备上安装声音云播放器.

更新

Soundcloud社区严格建议使用声音而不是曲目

String id = "114143409"; //Track id
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("soundcloud://sounds:" + id));
startActivity(intent);

标签:soundcloud,android
来源: https://codeday.me/bug/20190930/1837224.html