admin管理员组文章数量:1650776
一,语法:
<uses-feature android:name="string" //例如:android.hardware.bluetooth
android:required=["true"|"false"]
android:glEsVersion="integer"/>
<uses-feature>是声明APK的硬件或软件功能
属性解释:
android:name
软/硬件功能名称。
android:required
这个属性用一个boolean值来指定应用程序是否需要在android:name属性中所指定的功能。
true--默认值。在设备上不存在指定的功能时,则该应用不能够正常运行。
false--如果设备上存在指定的功能,则应用程序会倾向使用这个功能,但是如果需要,也可设计成没被指定的功能也能够正常运行。即:表示Android设备即使不支持该硬件,也能使用app;
android:qlEsVersion
APK需要的OpenGL ES的版本。它的高16位代表主版本号,低16位代表次要版本号,如:要是指定OpenGL ES的版本号是2.0,那么就要设置为0x00020000。要指定的OpenGL ES的版本号是2.1,就要设置为0x00020001。注意:一个字节占8位,两个十六进制占一个字节;即16位用四个十六进制表示;
备注:在AndroidManifest.xml文件中使用<uses-feature/>标签,来告诉Android应用市场此应用程序必须满足标签中指定功能才可以使用,这样应用市场会根据应用程序的指定的要求,来过滤所有不支持的设备。这种方法的缺点就是,只能过滤应用市场中的应用。如果通过其他来源的APP就没有效果了。
例如:检查手机是否支持蓝牙:
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
二,使用代码检查Android设备是否支持某些软/硬件功能
PackageManager pm = getPackageManager();
// 检查设备是否支持电话
boolean telephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
// 检查设备是否支持GSM
boolean gsm = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_GSM);
// 检查设备是否支持CDMA
boolean cdma = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_CDMA);
//检查设备是否支持NFC
boolean nfc = pm.hasSystemFeature(PackageManager.FEATURE_NFC);
三,软硬件特性
3.1,硬件特性
Audio android.hardware.audio.low_latency
Bluetooth android.hardware.bluetooth
Camera android.hardware.camera
android.hardware.camera.autofocus
android.hardware.camera.flash
android.hardware.camera.front
android.hardware.camera.any
Location android.hardware.location
android.hardware.locationwork
android.hardware.location.gps
Microphone android.hardware.microphone
NFC android.hardware.nfc
Sensors android.hardware.sensor.accelerometer
android.hardware.sensor.barometer
android.hardware.sensorpass
android.hardware.sensor.gyroscope
android.hardware.sensor.light
android.hardware.sensor.proximity
Screen android.hardware.screen.landscape
android.hardware.screen.portrait
Telephony android.hardware.telephony
android.hardware.telephony.cdma
android.hardware.telephony.gsm
Television android.hardware.type.television
Touchscreen android.hardware.faketouch
android.hardware.faketouch.multitouch.distinct
android.hardware.faketouch.multitouch.jazzhand
android.hardware.touchscreen
android.hardware.touchscreen.multitouch
android.hardware.touchscreen.multitouch.distinct
android.hardware.touchscreen.multitouch.jazzhand
USB android.hardware.usb.host
android.hardware.usb.accessory
Wifi android.hardware.wifi
3.2,软件特性:
Live Wallpaper android.software.live_wallpaper
SIP/VOIP android.software.sip
android.software.sip.voip
本文标签: AndroidManifestfeature
版权声明:本文标题:AndroidManifest 所有uses-feature 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729533734a1205143.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论