Android摄像头:需要额部或后置摄像头 [英] Android Camera: require frontal OR rear camera

查看:131
本文介绍了Android摄像头:需要额部或后置摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要一个摄像头的工作。然而,这并不重要,如果它是一个后部或前部摄像头无所谓。

My app needs a Camera to work. However, it doesn't matter if it's a rear or frontal camera.

现在,我有这个在我的清单:

Right now, I have this in my Manifest:

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

要需要一个正面的摄像头,我知道我还可以补充一点:

To require a frontal Camera, I know I could also add this:

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

但我想,以支持具有无论是相机中的所有设备。反正有没有做到这一点?

But I'd like to support all devices that has EITHER camera. Is there anyway to do this?

例如,我想支持的Nexus 7,只有一个正面的摄像头。但我也想支持,只有后置摄像头装置。

For example, I want to support Nexus 7 which has only a frontal camera. But I also want to support devices with rear camera only.

据一些研究,我做了,例如:

According to some research I've made, such as:

<一个href="http://$c$c.google.com/p/android/issues/detail?id=35166">http://$c$c.google.com/p/android/issues/detail?id=35166

看来这是不可能的。

我觉得要解决这个问题将是使2个单独的APK,其中一个android.hardware.camera和一个与android.hardware.camera.front无一不上传到谷歌播放,使用它的多APK支持。我没有测试它,但。

I think one way to solve this would be to make 2 separate APKs, one with android.hardware.camera and one with android.hardware.camera.front and upload both to Google Play, using its Multiple APK Support. I haven't tested it yet, though.

有没有人发现了一个推荐的方式支持与正面摄像头,后置摄像头或两者的所有设备,但没有设备,没有任何相机?

推荐答案

若干思考(没有确定的答案):

Several thoughts (no definite answer):

一)我相信你是正确的,目前还没有要求或者相机在APK好办法。

a) I believe you are right that currently there is no good way to require either camera in on APK.

二)如果你愿意,你可以删除的用途,功能,并为您在运行时的相机。这将使用户体验差,但它的工作。

b) If you want, you can remove uses-feature and check for a camera in runtime. It will make user experience worse, but it will work.

c)你可以使用使用所需=假(http://developer.android.com/guide/topics/manifest/uses-feature-element.html)。我们希望,谷歌市场使用此标志的优先级的应用程序。

c) You can use use required="false" (http://developer.android.com/guide/topics/manifest/uses-feature-element.html). Hopefully, Google Market prioritize applications using this flag.

C)附注。据我所知大多数Android设备有一个摄像头。所以,如果你去与解决方案b)或c)只有非常小的用户群就会发现其中的差别

c) Side note. As I know most of Android devices have a camera. So, if you go with solution b) or c) only very small user base will notice the difference

这篇关于Android摄像头:需要额部或后置摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆