[英]Support phones and phablets, not tablets
我最近将我的应用上传到Play商店,该商店仅支持手机和平板手机。 因此,根据https://developer.android.com/guide/practices/screens-distribution.html ,我在下方插入了仅支持电话和平板手机的代码
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.xxx.yyy.permission.C2D_MESSAGE" /> <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="xxhdpi" /> <screen android:screenSize="small" android:screenDensity="xxxhdpi" /> <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" /> <!-- 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" /> <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" /> </compatible-screens> <application android:name=".AppApplication" android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:largeHeap="true"/>
三星S8尝试安装时,开始出现怪异的事情。 它将具有三种可能性。 华为伴侣9也有类似的情况。
我的问题是,我该如何解决? Google Play控制台说,除了上面提到的平板电脑外,所有设备都受支持。 还是与最近的手机刚刚实现的WQHD有关?
编辑:该问题仅发生于那些升级到最新固件的用户,这使手机能够支持WQHD。
可以使用<supports-screens>
代替<compatible-screens>
,因为它不需要您指定应用程序支持的每个屏幕密度。
手机设备样本:
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="false"
android:xlargeScreens="false"
android:requiresSmallestWidthDp="320" />
资源:
干杯。
编辑更新为ANDROID OREO:
根据您的评论“已编辑: 只有升级到最新固件的用户才会出现此问题,这使手机能够支持WQHD。”
可能的逻辑原因:发出这些设备以前抑制真实屏幕(制造商/ android os)分辨率的问题,因此代码在所有设备上均按预期工作。
升级到新的Android OS / Oreo会释放出设备的真正屏幕分辨率功能时,会出现问题。
设置-显示-屏幕分辨率(共有3种设置)
建议的测试/验证是将分辨率设置为最低。 尝试安装/运行该应用程序。
参考: https : //www.androidcentral.com/understanding-galaxy-s8s-display-resolution-options
目前,这绝对不在您的代码控制范围之内,因为它提供了对Android API 8.0 Oreo util文档的全新升级,与此同时,您可以设法解决这些设备的最大分辨率问题或教育用户。
除了@Khalid答案,使用<support-screens>
将启用屏幕兼容模式,并使平板电脑用户能够下载。
这是不可避免的,因为<compatible-screens>
无法区分较新版本的Android(或Samsung),这使用户可以动态设置分辨率(HD +,FHD +和WQHD +),并且无法真正确定屏幕密度。
为了解决这个问题,我在应用启动时添加了一个验证器以检查屏幕尺寸。
public boolean checkUnsupportedSize() {
int screenSize = this.getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK;
switch(screenSize) {
case Configuration.SCREENLAYOUT_SIZE_SMALL:
return false;
case Configuration.SCREENLAYOUT_SIZE_NORMAL:
return false;
default:
return true;
}
}
if (checkUnsupportedSize()) {
YourActivity.this.finish();
}
由于手机和平板手机将始终使用“小”和“正常”的“屏幕尺寸”,因此我们可以区分其他屏幕尺寸并强制退出应用。
在Google Play对手机,平板手机和平板电脑进行适当的过滤之前,这是我能想到的解决方法。
干杯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.