gun*_*ess 9 android android-camera android-camera2
我正在尝试实现相机应用程序.并检查示例.一些示例包含以下清单功能:uses-feature android:name="android.hardware.camera2.full.我检查过官方文档和谷歌示例,但没有一个提到现有的这个功能.(或者我错过了一些).
这个功能的来源是什么android.hardware.camera?有什么区别?
编辑:让我困惑的是这些例子googlesamples:
还有这个
还有这个
他们正在使用新的Camera2API和旧的清单features.我不知道两者是如何结合在一起的.
Edd*_*ala 10
功能标志和相机API的名称实际上并不相关,即使它们看起来相同.
功能"android.hardware.camera"(PackageManager.FEATURE_CAMERA)表示该设备具有后置摄像头.就这样; 任何想要避免安装在没有后置摄像头的设备上的应用都需要列出那个.
它与Java android.hardware.Camera类无关.
功能"android.hardware.camera.level.full"(PackageManager.FEATURE_CAMERA_LEVEL_FULL)表示,当通过API包使用时,设备上至少有一个摄像头支持FULL硬件级别android.hardware.camera2.
所以带有后置摄像头的设备总是列出"android.hardware.camera".如果它有一个很好的相机,它也会列出"android.hardware.camera.level.full".
由于camera2的示例应用程序可以在任何质量的相机上运行,因此它们只需要有相机设备,而不是它具有任何特定级别的功能.
我见过一些开发人员试图要求像"android.hardware.camera2"这样的功能; Android SDK中没有定义此类功能,因此尝试要求它意味着您的应用无法安装在任何设备上.camera2 API始终可以从Android 5.0(Lollipop)开始使用; 这只是每个相机设备支持的硬件级别(LEGACY,LIMITED,FULL或LEVEL_3)的问题.
与往常一样,最好查看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>
我希望可以阐明您提到的功能的性质。
至于camera2api-那些是在Android 5(api级别21)中引入的,旨在创建更清洁的api以与旧的cameraapi 进行与相机的交互。
| 归档时间: |
|
| 查看次数: |
3927 次 |
| 最近记录: |