Is there a way to check if an app is running on an Android TV or Android Mobile?
I know how to check the running build. I want to start a specific service if the app is
private boolean isDirectToTV() {
return(getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)
|| getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK));
}
This will return true
if the device is advertising itself as having either the android.hardware.type.television
or android.software.leanback
system features. Android TV and Fire TV handle this correctly; I have not tried it on other environment as yet.