安卓:启用/禁用摄像头编程摄像头

2023-09-06 06:35:01 作者:年轻就是资本

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

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 ;)

 
精彩推荐
图片推荐