Android:是否可以从没有 UI 的服务中用相机拍照 [英] Android: Is it possible to take a picture with the camera from a service with no UI

查看:20
本文介绍了Android:是否可以从没有 UI 的服务中用相机拍照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用相机拍照的唯一代码是从活动中运行的.我相当确定可以从服务中或从服务启动的 AsyncTask 中拍摄照片.

The only code I have been able to get working to take a picture with the camera runs from an activity. I am fairly certain that it is possible to take a photo from within a service, or from an AsyncTask launched by the service.

在我看来,相机 API 需要一个必须绑定到 UI 中的 SurfaceView.也许我错了.有没有人编写过可以从服务中获取照片的代码?

It seems to me that the camera API needs a SurfaceView which must be tied into a UI. Maybe I am wrong. Has anyone written code where a photo can be taken from a service?

推荐答案

我认为这是不可能的,因为相机需要预览屏幕.查看类似问题这里

I don't think this is possible as the camera needs a preview screen. See similar question here

这篇关于Android:是否可以从没有 UI 的服务中用相机拍照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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