Created
June 27, 2015 15:43
-
-
Save rocboronat/894389c135bf2cc152cd to your computer and use it in GitHub Desktop.
A Util to useful and common Android TV things
This file contains hidden or 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
package com.fewlaps.electroswingrevolution.util; | |
import android.app.UiModeManager; | |
import android.content.Context; | |
import android.content.res.Configuration; | |
import android.util.Log; | |
/** | |
* @author Roc Boronat ([email protected]) | |
* @date 27/06/2015 | |
*/ | |
public class AndroidTVUtils { | |
public static boolean isAndroidTV(Context context) { | |
UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE); | |
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { | |
Log.d("TV", "Running on a TV Device"); | |
return true; | |
} else { | |
Log.d("TV", "Running on a non-TV Device"); | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment