开发者

Hierarchical logic for uses-feature?

开发者 https://www.devze.com 2023-02-17 06:23 出处:网络
I have an Android app that has an optional feature using the camera. So I have <uses-permission android:name=\"android.permission.CAMERA\"/>

I have an Android app that has an optional feature using the camera. So I have

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

in my manifest. Since the app works just fine without the feature I have

<uses-feature android:name="android.hardware.camera" android:required="false"/>

Now the interesting thing is that the Motodev Studio app validator reports that I should add

<uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

however I would have thought that required value is inherited. I can not find any documentation on that so should I just put it in for good measur开发者_Go百科e?


As you've probably seen by now, the hierarchy is from more specific to least. This means that if you specify android.hardware.camera.autofocus then android.hardware.camera is implied. Not the reverse. If you really need an autofocus camera, then you need to specify it. Otherwise you will get whatever camera the device has, which may or may not be AF or have a flash.

-E

0

精彩评论

暂无评论...
验证码 换一张
取 消