Skip to content

Instantly share code, notes, and snippets.

@seventhmoon
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seventhmoon/a319e8505ffd4a8ec62e to your computer and use it in GitHub Desktop.
Save seventhmoon/a319e8505ffd4a8ec62e to your computer and use it in GitHub Desktop.
Detect UI mode is TV or not
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