Skip to content

Instantly share code, notes, and snippets.

View elizacamber's full-sized avatar

Eliza Camber elizacamber

View GitHub Profile
@elizacamber
elizacamber / GetYoutubePlayPlaylistIntent.java
Created August 8, 2017 08:58
Intent for playing a playlist in the youtube app
public static Intent getYoutubePlayPlaylistIntent(Context context, String googleId) {
String url = String.valueOf("https://www.youtube.com/playlist?list=");
String mGoogleId = String.valueOf(googleId);
if (mGoogleId.length() != 0) {
url = url.concat(mGoogleId);
}
Uri uri = Uri.parse(url).buildUpon().appendQueryParameter("playnext", "1").build();
Intent intent = new Intent("android.intent.action.VIEW", uri).setPackage("com.google.android.youtube");
PackageManager packageManager = context.getPackageManager();