androidandroid-tv

How can I check if an app is running on an Android TV


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 running on an Android TV vs Mobile. Was hoping to house the two under the same library.


Solution

  • Some options are:

    1) Query the system for a large screen

    2) Use reflection to detect TV specific classes

    3) Use hasSystemFeature to detect the lack of touchscreen

    More info

    https://developer.android.com/training/tv/start/hardware.html

    And a similar answer for Google TV

    Identify GoogleTv from Android app