tba tba - 1 year ago 88
Android Question

Force video to open in Youtube app on Android

I have a mobile website that links to a youtube video. On Android, clicking on this link brings up a dialog asking the user to "Complete action using" their browser or the Youtube app.

Is there a way to bypass this screen and just play the video in the Youtube app? (For example with a youtube:// URL.)


Tim Tim
Answer Source

Here's how you can do that:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube://" + id));

The id is the identifier after the questionmark in the url. For example: youtube.com/watch?v=ID

Another way is:

Intent videoIntent = new Intent(Intent.ACTION_VIEW);
videoIntent.setClassName("com.google.android.youtube", "com.google.android.youtube.WatchActivity");


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download