限制Android

时间:2015-07-27 17:08:25

标签: android android-manifest

限制Android应用安装到手持设备的正确方法应该是使用清单中的compatible-screen元素(https://developer.android.com/guide/topics/manifest/compatible-screens-element.html)。

然而,这实际上不起作用(或不再起作用?)。

如果我对此文档的理解是正确的,那么Google Play应声明我的应用程序与任何平板电脑设备不兼容:

<compatible-screen>
    <screen android:screenDensity="ldpi" android:screenSize="small" />
    <screen android:screenDensity="mdpi" android:screenSize="small" />
    <screen android:screenDensity="hdpi" android:screenSize="small" />
    <screen android:screenDensity="xhdpi" android:screenSize="small" />
</compatible-screen>

但事实并非如此。在更新和等待几天后,Google Play会一直声明该应用与我的所有设备(包括平板电脑)兼容。

是否存在误解,或者文档是否不是最新的?

1 个答案:

答案 0 :(得分:2)

您是否将其声明为 AndroidManifest.xml <manifest>元素的直接子元素?

<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" />
    <screen android:screenSize="small" android:screenDensity="480" />
    <screen android:screenSize="small" android:screenDensity="640" />

    <!-- 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" />
    <screen android:screenSize="normal" android:screenDensity="480" />
    <screen android:screenSize="normal" android:screenDensity="640" />
</compatible-screens>

不要忘记添加xxhdpixxxhdpi