Commit b394c461 by Oliver Woodman

Add utility method to query whether device is an AndroidTV.

parent a1ab1fc2
......@@ -20,8 +20,10 @@ import com.google.android.exoplayer.ExoPlayerLibraryInfo;
import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DataSpec;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.text.TextUtils;
......@@ -81,6 +83,17 @@ public final class Util {
private Util() {}
/**
* Returns whether the device is an AndroidTV.
*
* @param context A context.
* @return True if the device is an AndroidTV. False otherwise.
*/
@SuppressLint("InlinedApi")
public static boolean isAndroidTv(Context context) {
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
}
/**
* Returns true if the URL points to a file on the local device
*
* @param url The URL to test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment