How to launch Youtube application to open a channel?

14,896

Solution 1

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(urlStr));
startActivity(intent);

if you use the url of a youtube channel such as: http://www.youtube.com/user/JustinBieberVEVO

this should give you the option to open youtube to the given channel.

hope this helps!

Solution 2

I know this answer is late and such but i wanted to share this anyway. This worked for me:

vnd.youtube://user/channel/channel_id

This opens the channel directly in the youtube app. Without asking the user.

Update

Didn't include any code because i was using React Native, and maybe people is looking for native code. Anyway here you go:

Linking
    .openURL( 'vnd.youtube://user/channel/' + channel_id )
    .catch( ... )

But, i think in native code it should be something like this:

Intent appIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube://user/channel/" + channel_id));
try {
  context.startActivity(appIntent);
} catch (ActivityNotFoundException ex) { ... }

I'm not too familiarized with native code so it may be wrong, but should work like a guide.

Share:
14,896
androniennn
Author by

androniennn

Updated on July 02, 2022

Comments

  • androniennn
    androniennn almost 2 years

    I want to access from my application to youtube to open a channel. I've searched for a solution but i just found how to open/stream a video :

    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:VIDEO_ID"));
    startActivity(i);
    

    But what about opening directly a channel?

    Thank you very much.

  • Silas Greenback
    Silas Greenback over 11 years
    I was hoping the link was not actually beiber but something, really anything, else. Oh well. Thanks for the intent tip.
  • Nicolás Alarcón Rapela
    Nicolás Alarcón Rapela about 6 years
    You should an explain or more information or included the code
  • Zenntro
    Zenntro about 6 years
    @NicolásAlarcónR. hope that helps a little bit.
  • Nicolás Alarcón Rapela
    Nicolás Alarcón Rapela about 6 years
    Best . Everything is achieved with practice! @marcoaguayo1915
  • Sam Chen
    Sam Chen over 3 years
    vnd.youtube://channel/' + channel_id works for me (without user).