Force a Soundcloud track to open in Soundcloud app on Android

徘徊边缘 提交于 2019-12-29 05:36:51

问题


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.

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);

回答1:


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);

Important : You have to have install the sound cloud player on your android device.

Update

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);



回答2:


Scheme soundcloud://tracks is not working some android devices. As from soundcloud community they strictly recommend using sounds instead of tracks

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



回答3:


The same works with users:

String id = "123395690"; //Userid
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("soundcloud://users:" + id));
startActivity(intent);


来源:https://stackoverflow.com/questions/19513977/force-a-soundcloud-track-to-open-in-soundcloud-app-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!