Android:在后台持续监听相机拍照

发布于 2024-10-06 14:53:59 字数 341 浏览 0 评论 0原文

我对 Android 开发非常陌生(认为是昨天开始的),在我的应用程序中,我试图监听何时使用相机拍照。另外,我需要始终监听此操作,以便我的应用程序可以“关闭”,但它仍然会在后台监听相机拍摄图像的时间(我的应用程序将执行一旦最初设置,几乎完全在后台)。不管怎样,我一直在网上进行了大量的阅读和搜索,我发现最好的方法可能是使用 BroadcastReceiver,但我还没有看到一个很好的设置示例像这样的事情。实际上,我只是非常困惑如何设置 BroadcastReceiver 以及如何开始其工作。有人可以为我提供一个很好的例子来说明如何做到这一点吗?有人用过类似的东西来监听相机拍照吗?即使应用程序“关闭”,此方法对我有用吗?

预先感谢您提供的任何帮助!

I'm very new to Android development (think started yesterday) and in my application I'm trying to listen for when the camera is used to take a picture. Also, I need to listen for this action all the time such that my application can "close", but it'll still be listening in the background for when the camera takes an image (my application will execute almost entirely in the background once it's setup initially). Anyway, I've been doing a ton of reading and searching online and such and I've found that the best way, probably, to do this is to use a BroadcastReceiver, but what I've not seen is a good example of setting something like this up. I'm actually just very confused how to set up the BroadcastReceiver and how to start it working. Could someone provide me with a good example of how this should be done? Has anyone ever used something like this to listen for the camera taking a picture? Will this method work for me even if the application is "closed"?

Thanks in advance for any help you can provide!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独陪着我 2024-10-13 14:54:00

查看这篇文章。 它解释了不同可用的用法感知他们的听众以及如何利用他们。它没有明确为您提供相机的代码,但只要您了解基础知识,就足以快速开始您的进步。

Check this article out. It explains usage of the different available sensors their listeners and how to tap into them. It isn't explicitly giving you code for you camera but should be enough to jump start your progress provided you know the basics.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文