AndroidManifest 所有uses-feature

一,语法:

<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.location.network
                  android.hardware.location.gps
Microphone        android.hardware.microphone
NFC               android.hardware.nfc
Sensors           android.hardware.sensor.accelerometer
                  android.hardware.sensor.barometer
                  android.hardware.sensor.compass
                  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

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ang_qq_252390816

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值