Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.