【问题标题】:How to distinguish if Android app runs on Smartphone/Tablet or Android-TV-Stick?如何区分 Android 应用程序是在智能手机/平板电脑还是 Android-TV-Stick 上运行?
【发布时间】:2020-11-04 14:13:36
【问题描述】:

我申请了following to distinguish between normal Android OS and Android TV

if (pm.hasSystemFeature("com.google.android.tv")) {
    // here it is a Android TV
} else {
    // here it is a smartphone or tablet or Car
}

它不适用于基于 Android 的电视棒。我认为它仅适用于 GoogleTv?

如何检查任何基于 Android 的电视?

【问题讨论】:

  • 框架中没有任何内容可以让您知道应用程序在什么类型的系统上运行,更不用说只有以 Android 作为操作系统的电视了,从技术上讲,这仍然只是 Android

标签: android android-tv android-package-managers


【解决方案1】:

我们通过android.software.leanbackcom.google.android.tv.installed 匹配。前者是检查它的“官方”方式,但制造商当然总是做自己的事情。

后者是通过检查很多不同的设备而选择的,之后我们没有收到任何关于不支持电视硬件的投诉。


要在清单中使用 <uses-feature ...> 发布到 PlayStore,我们采用了发布两个变体的方法,每个变体都具有一项功能作为要求...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-27
    • 2012-07-05
    • 1970-01-01
    • 1970-01-01
    • 2022-11-30
    • 2012-07-05
    • 2021-07-12
    相关资源
    最近更新 更多