如何检查应用程序是否在 Android TV 上运行 [英] How can I check if an app is running on an Android TV
本文介绍了如何检查应用程序是否在 Android TV 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法检查应用是否在 Android TV 或 Android 手机上运行?
Is there a way to check if an app is running on an Android TV or Android Mobile?
我知道如何检查正在运行的构建.如果应用程序在 Android TV 与 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.
推荐答案
一些选项是:
1) 向系统查询大屏
2) 使用反射来检测特定于电视的类别
2) Use reflection to detect TV specific classes
3) 使用 hasSystemFeature 检测缺少触摸屏
3) Use hasSystemFeature to detect the lack of touchscreen
更多信息
https://developer.android.com/training/tv/start/hardware.html
Google TV 的类似答案
And a similar answer for Google TV
这篇关于如何检查应用程序是否在 Android TV 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文