Android - 声明应用程序仅适用于手机

时间:2017-05-19 18:59:20

标签: android google-play

我知道这个问题有答案,但它们都已有2年多了。

确保您的应用仅限于手机,而不是平板电脑,电视,手表等的更新方式是什么?

2 个答案:

答案 0 :(得分:0)

You should look at this

在你的清单中,你声明:

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

根据Android文档(请参阅顶部链接),这是仅支持手机的方式。但要记住的是,还要支持xxhdpi和xxxhdpi。屏幕大小是关键属性。 S6 edge的屏幕尺寸为xxxhdpi,所以这是你应该记住的事情。

我修改了上面的剪辑以包含xxxhdpi密度。请注意,密度与屏幕大小无关。设备可以是3英寸但是xxxhdpi。

根据我在文档中看到的内容,只需在清单中声明上述内容即可阻止平板电脑下载该应用。

至于支持手表和电视,这是你特别需要支持的东西。 Android手表的实例,需要Android Wear API。您无法运行使用“普通”API设计的应用并在手表上使用它。同样适用于电视,您必须特别支持它。那里也可能有一个自定义API,不确定,因为我没有与Android TV有任何关系

答案 1 :(得分:0)

我使用了以下代码并且工作正常。

<uses-feature android:name="android.hardware.telephony" android:required="true" />