android判断当前设备的支持哪些Feature

可以使用  public abstract boolean hasSystemFeature (String name)

判断是否支持下列某个属性:

FEATURE_AUDIO_LOW_LATENCY

FEATURE_BLUETOOTH
FEATURE_CAMERA
FEATURE_CAMERA_AUTOFOCUS
FEATURE_CAMERA_FLASH
FEATURE_CAMERA_FRONT
FEATURE_FAKETOUCH
FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT
FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND
FEATURE_LIVE_WALLPAPER
FEATURE_LOCATION
FEATURE_LOCATION_GPS
FEATURE_LOCATION_NETWORK
FEATURE_MICROPHONE
FEATURE_NFC
FEATURE_SCREEN_LANDSCAPE
FEATURE_SCREEN_PORTRAIT
FEATURE_SENSOR_ACCELEROMETER
FEATURE_SENSOR_BAROMETER
FEATURE_SENSOR_COMPASS Feature 
FEATURE_SENSOR_GYROSCOPE
FEATURE_SENSOR_LIGHT
FEATURE_SENSOR_PROXIMITY
FEATURE_SIP
FEATURE_SIP_VOIP
FEATURE_TELEPHONY
FEATURE_TELEPHONY_CDMA
FEATURE_TELEPHONY_GSM
FEATURE_TOUCHSCREEN
FEATURE_TOUCHSCREEN_MULTITOUCH
FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT
FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND
FEATURE_USB_ACCESSORY
FEATURE_USB_HOST
FEATURE_WIFI

FEATURE_WIFI_DIRECT

在应用程序中使用方法

if(!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)){
/**/
}

还可以用  getSystemAvailableFeatures   ()列出当前设备所有属性。

-------------------------------------------------------------------------------------------------



对于设备端来说,是否支持这些feature,就要放各种.xml文件到 /system/etc/permissions下面

诸如:

android.hardware.camera.front.xml
android.hardware.location.gps.xml
android.hardware.sensor.accelerometer.xml
android.hardware.telephony.gsm.xml
android.hardware.touchscreen.multitouch.jazzhand.xml
android.hardware.usb.accessory.xml
android.hardware.wifi.xml

等等

这些文件存在于frameworks/base/data/etc

修改Android.mk就可把他们放到/system/etc/permissions里面去了。

这可以解决Google market(现在叫做play)里面显示应用较少的问题。

你可能感兴趣的:(android,String,audio)