我正在尝试实现一个相机应用程序。和检查例子。一些示例包含以下清单特性:uses-feature android:name="android.hardware.camera2.full
。我检查了官方文档和谷歌的例子,但没有提到现有的这一功能。(或者说我漏掉了一些)。
这个特性的来源是什么?android.hardware.camera
之间的区别是什么?
编辑:让我困惑的是googlesamples
上的那些例子
还有这个
还有这个
他们正在使用新的Camera2
API和旧的清单features
。我不知道两者是如何结合在一起的。
发布于 2018-01-04 12:15:44
和往常一样,最好还是看看Android 源代码本身:
* A given camera device may provide support at one of two levels: limited or * full. If a device only supports the limited level, then Camera2 exposes a * feature set that is roughly equivalent to the older * {@link android.hardware.Camera Camera} API, although with a cleaner and more * efficient interface. Devices that implement the full level of support * provide substantially improved capabilities over the older camera * API. Applications that target the limited level devices will run unchanged on * the full-level devices; if your application requires a full-level device for * proper operation, declare the "android.hardware.camera2.full" feature in your * manifest.</p>
我希望这能澄清你提到的特征的本质。
至于camera2
api --它们是Android5(APILevel21)中的介绍,目的是创建更干净的api,以便与相机交互,而不是旧的camera
api。
发布于 2018-01-05 20:34:20
特性标志和相机API的名称实际上并不相关,尽管它们看起来是一样的。
功能照相机)意味着该设备有一个背向摄像头.仅此而已;任何想要避免安装在没有背向摄像头的设备上的应用程序都需要列出这一项。
它与Java android.hardware.Camera
类无关。
特性已满)表示,当通过android.hardware.camera2
API包使用时,设备上至少有一个摄像头支持android.hardware.camera2
。
因此,带有背向摄像头的设备总是列出"android.hardware.camera“。如果它有一个好的相机,它也会列出"android.hardware.camera.level.full“。
由于camera2的示例应用程序是在任何质量的相机上运行的,所以它们只需要有一个相机设备,而不是它有任何特定的功能。
我见过一些开发人员试图要求像“android.hardware.camera2”这样的功能;在Android中没有这样的特性,所以尝试要求它意味着您的应用程序不能安装在任何设备上。从Android5.0(Lollipop)开始就可以使用camera2 API;这只是一个问题,即每个相机设备所支持的硬件级别(传统的、有限的、完全的或LEVEL_3的)。
发布于 2018-01-04 12:18:03
从Android 21开始,Android就引入了Camera2 api,这种新的摄像头API使得它更易于使用和更改参数。以前的版本在其能力上更为有限。
Android Camera2有4个级别的实现,取决于制造商:
来源在这里和个人经验。
https://stackoverflow.com/questions/48094952
复制相似问题