Last active
August 29, 2015 14:25
-
-
Save seventhmoon/a319e8505ffd4a8ec62e to your computer and use it in GitHub Desktop.
Detect UI mode is TV or not
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
import android.app.Application; | |
import android.app.UiModeManager; | |
import android.content.res.Configuration; | |
/** | |
* Created by fung.lam on 27/07/2015. | |
*/ | |
public class DefaultApplication extends Application { | |
private boolean isRunningOnTv(){ | |
UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); | |
return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment