6

I know one can obtain screen sizes, but I would like to know if someone has ever been able to find out if the Android device has a screen or not. i.e. whether it is a set top box or not.

I guess screen size returned should be "zero", but I am not sure if that is actually the response in the real world.

Thank you.

Carlos F
  • 893
  • 2
  • 12
  • 30

1 Answers1

4

You can check for a TV device.

public static final String TAG = "DeviceTypeRuntimeCheck";

UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE);
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
    Log.d(TAG, "Running on a TV Device");
} else {
    Log.d(TAG, "Running on a non-TV Device");
}
Alex Baker
  • 1,537
  • 2
  • 13
  • 28