如何设置安卓应用仅支持手机,移除Google Play其他设备形态支持?
仅向安卓手机开放应用的配置方案
核心配置调整
1. 精准锁定手机形态设备
仅依赖android.hardware.telephony无法彻底排除平板(部分平板支持通话功能),需在AndroidManifest.xml中添加专门标识手机形态的特性要求:
<uses-feature android:name="android.hardware.type.phone" android:required="true" />
这个配置直接限定设备必须是手机形态,能有效过滤平板、TV、车机等非手机设备。
如果仍有TV设备残留,可补充声明无需这类设备特性:
<uses-feature android:name="android.hardware.type.television" android:required="false" /> <uses-feature android:name="android.hardware.type.automotive" android:required="false" />
2. 修正屏幕支持配置
之前的support-screens未生效大概率是配置参数不对,正确限定手机屏幕的配置如下:
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="false" android:xlargeScreens="false" android:requiresSmallestWidthDp="320" />
关闭大尺寸屏幕支持,并限定最小宽度为手机常用的320dp,进一步过滤平板设备。
程序化维护方案
将上述配置固定在AndroidManifest.xml中,每次打包发布时配置会自动生效,无需手动修改Google Play的设备目录。发布前可通过Google Play Console的预发布报告,验证当前支持的设备列表是否符合预期。
若有特殊场景(比如需兼容少数通话平板),可将android.hardware.type.phone的required设为false,再通过代码在运行时判断设备类型,给非手机用户弹出适配提示。
内容的提问来源于stack exchange,提问作者monchisan
相关产品推荐
相关产品推荐

