简体   繁体   English

为平板电脑和手机指定apk

[英]Specify apk for tablets and phones

What is the best way to target just phones and tablets for an android application? 针对Android应用程序定位手机和平板电脑的最佳方法是什么? Meaning, I want to exclude TVs (do not allow users with a googleTV to download the app). 这意味着,我想排除电视(不允许使用googleTV的用户下载该应用)。

I've seen the following for small and normal size screens, regardless of screen density. 无论屏幕密度如何,我都会看到以下尺寸和正常尺寸的屏幕。 It seems like a bit of an overkill, is there a more concise way? 这似乎有点矫枉过正,有更简洁的方法吗?

<compatible-screens>
        <!-- all small size screens -->
        <screen android:screenSize="small" android:screenDensity="ldpi" />
        <screen android:screenSize="small" android:screenDensity="mdpi" />
        <screen android:screenSize="small" android:screenDensity="hdpi" />
        <screen android:screenSize="small" android:screenDensity="xhdpi" />
        <!-- all normal size screens -->
        <screen android:screenSize="normal" android:screenDensity="ldpi" />
        <screen android:screenSize="normal" android:screenDensity="mdpi" />
        <screen android:screenSize="normal" android:screenDensity="hdpi" />
        <screen android:screenSize="normal" android:screenDensity="xhdpi" />
    </compatible-screens>

By default, Android applications do not appear compatible with Google TV devices - they require the following line added to their AndroidManifest.xml : 默认情况下,Android应用程序似乎与Google TV设备兼容 - 它们需要在AndroidManifest.xml添加以下行:

<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

So you shouldn't have to do anything to exclude Google TV devices or any other future devices that don't have a touchscreen. 因此,您不必做任何事情来排除Google TV设备或任何其他没有触摸屏的设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM