Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我计划使用一项服务,在其中我将使用计时器调用 takePicture 方法。这个程序有什么限制吗?
每次拍照后都需要setPreviewDisplay吗?
为什么需要服务?从您所说的情况来看,除了运行计时器来说明何时执行有关拍照的操作之外,该服务将在很长一段时间内什么都不做。
您的架构可以使用警报吗?您的用户会感谢您,因为它的电池消耗量要小得多,而且它可以为您处理所有计划,以及该操作是否需要多次发生。这一切都是通过AlarmManager 完成的。可以在任何时间安排警报,甚至还有一些有用的时间枚举,例如天、小时……等。