=============================== 硬件feature
2。 运行时检测设备配置,动态disable不支持的feature
2。1 在manifest中描述要使用的feature,让平台来判断
<uses-feature android:name="android.hardware.sensor.compass" android:required="true" />
2。2 自己判断
1。 设备feature描述
.FEATURE_XXX 2。检测PackageManager.hasSystemFeature(
。。)public abstract FeatureInfo[] getSystemAvailableFeatures ()
public abstract boolean hasSystemFeature (String name)
Hardware features
The table below describes the hardware feature descriptors supported by themost current platform release. To signal that your application uses or requiresa hardware feature, declare each value in a
android:name
attributein a separate<uses-feature>
element.
Feature Type | Feature Descriptor | Description | Comments |
---|---|---|---|
Audio | android.hardware.audio.low_latency | The application uses a low-latency audio pipeline on the device andis sensitive to delays or lag in sound input or output. | |
Bluetooth | android.hardware.bluetooth | The application uses Bluetooth radio features in the device. | |
android.hardware.bluetooth_le | The application uses Bluetooth Low Energy radio features in the device. | ||
Camera | android.hardware.camera | The application uses the device's camera. If the device supports multiple cameras, the application uses the camera that facing away from the screen. | |
android.hardware.camera.autofocus | Subfeature. The application uses the device camera's autofocus capability. | These subfeatures implicitly
declare theandroid.hardware.camera parent feature, unless declared withandroid:required="false" . | |
android.hardware.camera.flash | Subfeature. The application uses the device camera's flash. | ||
android.hardware.camera.front | Subfeature. The application uses a front-facing camera on the device. | ||
android.hardware.camera.any | The application uses at least one camera facing in any direction, or anexternal camera device if one is connected. Use this in preference
toandroid.hardware.camera if a back-facing camera is not required. | ||
android.hardware.camera.external | The application uses an external camera device if one is connected. | ||
android.hardware.camera. | The
application uses a camera device with FULL -level support. | ||
android.hardware.camera. | The application uses a a camera device with the MANUAL_SENSOR capability. | ||
android.hardware.camera. | The
application uses a a camera device with the MANUAL_POST_PROCESSING capability. | ||
android.hardware.camera | The application uses a a camera device with the RAW capability. | ||
Infrared | android.hardware.consumerir | The application uses the consumer IR capabilities on the device. | |
Location | android.hardware.location | The application uses one or more features on the device for determininglocation, such as GPS location, network location, or cell location. | |
android.hardware.location.network | Subfeature. The application uses coarse location coordinates obtained froma network-based geolocation system supported on the device. | These
subfeatures implicitly declare theandroid.hardware.location parent feature, unless declared withandroid:required="false" . | |
android.hardware.location.gps | Subfeature. The application uses precise location coordinates obtainedfrom a Global Positioning System receiver on the device. | ||
Microphone | android.hardware.microphone | The application uses a microphone on the device. | |
NFC | android.hardware.nfc | The application uses Near Field Communications radio features in the device. | |
android.hardware.nfc.hce | The application uses the NFC card emulation feature in the device. | ||
Sensors | android.hardware.sensor.accelerometer | The application uses motion readings from an accelerometer on thedevice. | |
android.hardware.sensor.barometer | The application uses the device's barometer. | ||
android.hardware.sensor.compass | The application uses directional readings from a magnetometer (compass) onthe device. | ||
android.hardware.sensor.gyroscope | The application uses the device's gyroscope sensor. | ||
android.hardware.sensor.light | The application uses the device's light sensor. | ||
android.hardware.sensor.proximity | The application uses the device's proximity sensor. | ||
android.hardware.sensor.stepcounter | The application uses the device's step counter. | ||
android.hardware.sensor.stepdetector | The application uses the device's step detector. | ||
Screen | android.hardware.screen.landscape | The application requires landscape orientation. | For example, if your app requires portrait orientation, you should declare Both orientations are assumed not required, by default, so your app may be installedon
devices that support one or both orientations. However, if any of your activities request thatthey run in a specific orientation, using the For backwards compatibility, any device running a platform version that supports only APIlevel 12 or lower is assumed to support both landscape and portrait. |
android.hardware.screen.portrait | The application requires portrait orientation. | ||
Telephony | android.hardware.telephony | The application uses telephony features on the device, such as telephonyradio with data communication services. | |
android.hardware.telephony.cdma | Subfeature. The application uses CDMA telephony radio features on thedevice. | These
subfeatures implicitly declare theandroid.hardware.telephony parent feature, unless declared withandroid:required="false" . | |
android.hardware.telephony.gsm | Subfeature. The application uses GSM telephony radio features on thedevice. | ||
Television | android.hardware.type.television | The application is designed for a television user experience. | This feature defines "television" to be a typical living room television experience: displayed on a big screen, where the user is sitting far away and the dominant form of input is something like a d-pad, and generally not through touch or a mouse/pointer-device. |
Touchscreen | android.hardware.faketouch | The application uses basic touch interaction events, such as "click down", "clickup", and drag. | When declared as required, this indicates that the application is compatible with a deviceonly if it offers an emulated touchscreen ("fake touch" interface), or better. A device that offersa fake touch interface provides a user input system that emulates a subset of touchscreencapabilities. For example, a mouse or remote control that drives an on-screen cursor provides a faketouch interface. If your application requires basic point and click interaction (in otherwords, it won't work with only a d-pad controller), you should declare this feature.Because this is the minimum level of touch interaction, your app will also be compatible withdevices that offer more complex touch interfaces. Note: Because applications require the |
android.hardware.faketouch. | The application performs distinct tracking of two or more "fingers" on a fake touchinterface. This is a superset of the faketouch feature. | When declared as required, this indicates that the application is compatible with a deviceonly if it supports touch emulation for events that supports distinct tracking of two or morefingers, or better. Unlike the distinct multitouch defined by | |
android.hardware.faketouch. | The application performs distinct tracking of five or more "fingers" on a fake touchinterface. This is a superset of the faketouch feature. | When declared as required, this indicates that the application is compatible with a deviceonly if it supports touch emulation for events that supports distinct tracking of five or morefingers. Unlike the distinct multitouch defined by | |
android.hardware.touchscreen | The application uses touchscreen capabilities for gestures that are more interactivethan basic touch events, such as a fling. This is a superset of the basic faketouch feature. | By default, your application requires this. As such, your application is notavailable
to devices that provide only an emulated touch interface ("fake touch"), by default. Ifyou want your application available to devices that provide a fake touch interface (or even devicesthat provide only a d-pad controller), you must explicitly declare that
a touch screen is notrequired, by declaring If your application does require a touch interface (in order to perform touchgestures such as a fling), then you don't need to do anything, because this is required by default.However, it's best if you explicitly declare all features used by your application, so you shouldstill declare this if your app uses it. If you require more complex touch interaction, such as multi-finger gestures, youshould declare the advanced touch screen features below. | |
android.hardware.touchscreen.multitouch | The application uses basic two-point multitouch capabilities on the devicescreen, such as for pinch gestures, but does not need to track touches independently. Thisis a superset of touchscreen feature. | This implicitly declares the android.hardware.touchscreen
parent feature, unlessdeclared with android:required="false" . | |
android.hardware.touchscreen | Subfeature. The application uses advanced multipoint multitouchcapabilities on the device screen, such as for tracking two or more points fullyindependently. This is a superset of multitouch feature. | This implicitly declares the android.hardware.touchscreen.multitouch parent feature, unless declared with android:required="false" . | |
android.hardware.touchscreen. | The application uses advanced multipoint multitouchcapabilities on the device screen, for tracking up to five points fullyindependently. This is a superset of distinct multitouch feature. | ||
USB | android.hardware.usb.host | The application uses USB host mode features (behaves as the host and connects to USBdevices). | |
android.hardware.usb.accessory | The application uses USB accessory features (behaves as the USB device and connects to USBhosts). | ||
Wi-Fi | android.hardware.wifi | The application uses 802.11 networking (Wi-Fi) features on the device. | |
android.hardware.wifi.direct | The application uses the Wi-Fi Direct networking features on the device. |
Software features
The table below describes the software feature descriptors supported by themost current platform release. To signal that your application uses or requiresa software feature, declare each value in a android:name
attributein a separate <uses-feature>
element.
Feature | Attribute Value | Description |
---|---|---|
App Widgets | android.software.app_widgets | The application uses or provides App Widgets and should be installed only on devices that include a Home screen or similar location where users can embed App Widgets. |
Device Management | android.software.device_admin | The application uses device policy enforcement via device administrators. |
Home Screen | android.software.home_screen | The application behaves as a Home screen replacement and should be installed only on devices that support third-party Home screen apps. |
Input Method | android.software.input_methods | The application provides a custom input method and should be installed only on devices that support third-party input methods. |
Live Wallpaper | android.software.live_wallpaper | The application uses or provides Live Wallpapers and should be installed only on devices that support Live Wallpapers. |
SIP/VOIP | android.software.sip | The application uses SIP service on the device and should be installed only on devices that support SIP. |
android.software.sip.voip | Subfeature. The application uses SIP-based VOIP service on the device. This subfeature implicitly declares the |
============================== 软件sdk version
1. 平台判断,提供我的需求
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
2. 自己判断
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
// Running on something older than API level 11, so disable
// the drag/drop features that use ClipboardManager
APIs
disableDragAndDrop();
}
=============================== Screen configuration
4 size type:small, normal, large, and xlarge ,( landscape or portrait) is considered a variation ofscreen size
4 density type :mdpi (medium), hdpi (hdpi), xhdpi (extra high), xxhdpi (extra-extra high), and others
MyProject/ res/ layout/ # default (portrait) main.xml layout-land/ # landscape main.xml layout-large/ # large (portrait) main.xml layout-large-land/ # large landscape main.xml
- xhdpi: 2.0
- hdpi: 1.5
- mdpi: 1.0 (baseline)
- ldpi: 0.75
This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
Then, place the files in the appropriate drawable resource directory:
MyProject/ res/ drawable-xhdpi/ awesomeimage.png drawable-hdpi/ awesomeimage.png drawable-mdpi/ awesomeimage.png drawable-ldpi/ awesomeimage.png============================= language
MyProject/ res/ values/ strings.xml values-es/ strings.xml values-fr/ strings.xml