Created
October 10, 2018 20:33
-
-
Save slobodin/9f70dde9c678a65259062cc7eea57167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isAndroidTV() { | |
try { | |
Activity activity = GameActivity.getSharedActivity(); | |
UiModeManager uiModeManager = (UiModeManager) activity.getSystemService(UI_MODE_SERVICE); | |
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { | |
MyLog.i(TAG, "Running on a TV Device"); | |
return true; | |
} else { | |
MyLog.i(TAG, "Running on a non-TV Device"); | |
return false; | |
} | |
} catch (Exception e) { | |
MyLog.e(TAG, "Failed to call isAndroidTV"); | |
MyLog.e(TAG, e.getMessage()); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment