N S*_*rma 12 android android-screen-support
您好我将用户定位到Android手机.我想限制应用程序安装在Android手机上而不是平板电脑和平板电脑上.
我需要在AndroidManifest.xml中应用哪些配置,以便Google Play应用程序不会在表格和平板移动中显示该应用程序.
提前致谢.
Dis*_*ame 22
由于Nexus 5X,Nexus 6P和三星Galaxy S6等新设备的高密度,我们不得不调整清单如下:
<compatible-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="420" />
<screen android:screenSize="small" android:screenDensity="480" />
<screen android:screenSize="small" android:screenDensity="560" />
<screen android:screenSize="small" android:screenDensity="640" />
<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="420" />
<screen android:screenSize="normal" android:screenDensity="480" />
<screen android:screenSize="normal" android:screenDensity="560" />
<screen android:screenSize="normal" android:screenDensity="640" />
<screen android:screenSize="large" android:screenDensity="ldpi" />
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="large" android:screenDensity="hdpi" />
<screen android:screenSize="large" android:screenDensity="xhdpi" />
<screen android:screenSize="large" android:screenDensity="420" />
<screen android:screenSize="large" android:screenDensity="480" />
<screen android:screenSize="large" android:screenDensity="560" />
<screen android:screenSize="large" android:screenDensity="640" />
</compatible-screens>
Run Code Online (Sandbox Code Playgroud)
baa*_*h05 12
另一种方法是测试android.hardware.telephony的功能
<uses-feature android:name="android.hardware.telephony" android:required="true" />
Run Code Online (Sandbox Code Playgroud)
这会将应用程序限制为手机..当然,平板手机将包含在其中,但它将是(恕我直言)比不断变化的屏幕分辨率方法更好的解决方案.
引用文档:
由于系统通常可以扩展应用程序以适应更大的屏幕,因此您不需要从较大的屏幕中过滤应用程序.只要您遵循屏幕独立性最佳实践,您的应用程序就可以在平板电脑等大屏幕上正常运行.但是,您可能会发现您的应用程序无法正常扩展,或者您决定为不同的屏幕配置发布两个版本的应用程序.在这种情况下,您可以使用该
<compatible-screens>元素根据屏幕大小和密度的组合管理应用程序的分发.Google Play等外部服务使用此信息对您的应用程序应用过滤,因此只有具有您声明兼容性的屏幕配置的设备才能下载您的应用程序.
请记住,<compatible-screens>需要你到每一个屏幕大小白名单和密度,你是支持(我们得到的每一年左右新的密度),并且仅限于经典的屏幕尺寸桶(small,normal,large,xlarge).文档的示例缺少一些密度:
<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>
Run Code Online (Sandbox Code Playgroud)
如果愿意支持和设备tvdpi,则需要添加其他元素.xxhdpixxxhdpi
警告:通常,您不应使用此清单元素.使用此元素可以显着减少应用程序的潜在用户群,如果用户的设备具有未列出的屏幕配置,则不允许用户安装应用程序.当应用程序绝对不适用于特定的屏幕配置时,您应该仅将其用作最后的手段.您应该遵循支持多个屏幕的指南,而不是使用此元素,以使用不同的屏幕尺寸和密度的替代布局和位图为多个屏幕提供可扩展的支持.
请记住,像"phablet"这样的营销术语定义不明确,因此您的应用可能会在某些您认为是平板电脑或其他人认为是平板电脑的设备上出货.
| 归档时间: |
|
| 查看次数: |
12680 次 |
| 最近记录: |