Android 關於 的說明

 <uses-feature>  主要仍是被Play使用的.例子: java

<uses-feature android:name="android.hardware.touchscreen"         android:required="true"/>
若是設備沒有這個touchscreen這個硬件,  play就不會把app安裝到這個設備上.false的話仍是會安裝上.


Android apps can declare hardware feature requirements in the app manifest to ensure that they do not get installed on devices that do not provide those features. If you are extending an existing app for use on TV, closely review your app's manifest for any hardware requirement declarations that might prevent it from being installed on a TV device. android

Some features have subfeatures like android.hardware.camera.front, as described in the Feature Reference. Be sure to mark as required="false" any subfeatures also used in your app. app

舉例來說,個人App會使用到Camera,但不是必要的。為此我宣告了Camera的<uses-permission>,但省略了<uses-feature>。 ide

<uses-permission android:name="android.permission.CAMERA" />

此時Google Play發現了這個<uses-permission>,便會將Camera視為必要而進行過濾,沒有Camera的裝置就看不到個人App了,這樣跟我想要的結果不一樣。設置爲false就沒有這個問題了! ui


另外, App內部也能夠判斷是否支持這個硬件 spa

// Check if the camera hardware feature is available.
if (getPackageManager().hasSystemFeature("android.hardware.camera")) {
    Log.d("Camera test", "Camera available!");
} else {
    Log.d("Camera test", "No camera available. View and edit features only.");
}
相關文章
相關標籤/搜索