设备兼容

地址:https://developer.android.com/guide/practices/compatibility.html html

咱们能够限制应用在设备的可见,经过如下特性:
android

一、 设备功能ide

Android针对每个硬件功能或软件功能定义了功能的id,若是当设备不支持时你要阻止安装应用,要在manifest文件中定义<uses-feature>元素,若是你应用不是主要请求这个功能的须要设置request为false(默认都为false)。而后你能够动态判断当前设备是否有该功能经过hasSystemFeature()方法ui

PackageManager pm = getPackageManager();
if (!pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS)) {
   
// This device does not have a compass, turn off the compass feature
    disableCompassFeature
();
}

二、平台版本
spa

三、屏幕配置code

相关文章
相关标签/搜索