如何在android中在给定的时间间隔后连续拍照

发布于 2024-12-22 18:02:05 字数 91 浏览 5 评论 0原文

我计划使用一项服务,在其中我将使用计时器调用 takePicture 方法。这个程序有什么限制吗?

每次拍照后都需要设置PreviewDisplay吗?

i plan to use a service and within which i am gonna call takePicture method using timer. is there any limitation in this procedure?

do i need to setPreviewDisplay every time after taking a picture?

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

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

发布评论

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

评论(1

荆棘i 2024-12-29 18:02:05

为什么需要服务?从您所说的来看,除了运行计时器来说明何时执行有关拍照的操作之外,该服务在大部分时间内不会执行任何操作。

您的架构可以改用警报吗?您的用户会感谢您,因为它的电池消耗要少得多,而且它可以为您处理所有调度以及操作是否需要多次发生。这一切都是通过 AlarmManager 完成的。可以将警报安排在任何时间,甚至还有一些有用的时间枚举,例如天、小时等。

Why do you need a service? From what you have said it sounds like the service will be doing nothing for a large portion of time apart from running a timer to say when to do something regarding picture taking.

Can your architecture utilise an alarm instead? Your user will thank you as it is far less battery intensive plus it handles all the scheduling for you and if the action needs to happen more than once. This is all done via the AlarmManager. An alarm can be scheduled for any time and there are even some useful enumerations of time such as days, hours...etc.

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