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

前端 未结 4 1120
太阳男子
太阳男子 2021-02-07 06:29

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

4条回答
  •  长发绾君心
    2021-02-07 07:03

    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

提交回复
热议问题