安卓:启用/禁用摄像头编程 [英] Android:Enable/Disable Camera programatically

查看:1019
本文介绍了安卓:启用/禁用摄像头编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想启用/禁用摄像头以编程方式在我的应用程序。

I want to enable/disable camera programmatically in my application.

请帮助我,如果任何人有想法吧...

Please help me if any one has idea about it...

推荐答案

的OP是要求任何想法,我得到了一个想法,它可能工作即使不使用ICS所提供的API。

The OP is asking for any ideas, I got one idea and it could possibly work even without using the API provided by ICS.

较低的API版本比ICS,您可以启动将锁定相机时画面后松开,当屏幕关闭的服务。这是为了尽量减少电池的使用。

for lower API version than ICS, you can Start a service that will lock the Camera when the screen is On and Release it when the Screen is Off. This is to minimize the usage of battery.

一直以来,只有一个进程可以同时使用摄像头,其他的应用程序,如相机应用将无法使用相机。

Since, only one process can use the Camera at a time, other applications like the Camera App will not be able to use the Camera.

现在面临的挑战是如何保证服务霸占相机一直运行会被卸载用户prevent吧。

The challenge now is how to ensure that the Service Hogging the Camera is always Running and prevent it from being uninstalled by the user.

好了,只是一个想法;)

Well, just a thought ;)

这篇关于安卓:启用/禁用摄像头编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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