Android AlarmManager 耗电严重?

发布于 2024-11-28 13:15:12 字数 223 浏览 2 评论 0原文

大约 4 个月前,我刚刚开始开发 Android。 我创建了一个使用AlarmManager的项目,流程是这样的: AlarmManager->服务->wifi不可用->AlarmManager继续->服务..等等。 如果设备没有重新启动,此警报可能会安排几天。 我在项目的电池排水部分需要帮助。我如何知道我的 AlarmManager 项目耗尽电池的速度。我担心如果它耗尽大量电池,我的应用程序将不再有用。

i just started working on android about 4 months back.
i created a project that uses AlarmManager, the flow is like this:
AlarmManager->service->wifi not available->AlarmManager continues->service.. and so on.
this alarm may be scheduled for days, hopefully if the device is not rebooted.
I required help in the Battery drainage part of the project. How may i know the rate at which my AlarmManager Project is draining the battery. I fear that if it draining a lot of battery, my app wont be useful.

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

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

发布评论

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

评论(1

回忆那么伤 2024-12-05 13:15:12

有一些事情可能会消耗大量电池电量,例如显示屏、访问和 Wifi 扫描、蓝牙、GPS、动态壁纸等。在论坛之类的地方闲逛,我看到很多人抱怨电池使用时间短,这实际上很容易理解,但如果他们仔细看看你的手机经常使用的所有资源,他们就不会这么认为了。一点也不惊讶。就我个人而言,我已经习惯在不使用手机时每天给手机充电两次。

不过,我有一些建议给您:

  1. 我实际上不太熟悉 AlarmManager 的工作原理,但我想您可以降低计划警报的频率以节省电池时间。有很多应用程序会自动启动,但不确定它们是否使用此方法!

  2. 使用 JuiceDeffender(我认为)和 JuicePlotter。这些应用程序可以及时监控和绘制电池消耗情况。

  3. 进行测试:在某一天安排闹钟,在另一天则不要!然后分析电池电量。

  4. 也许 android.stackexchange.com 中的人们对 Android 功耗有更深入的了解。问问他们吧!

干杯!

There are several things which may consume a lot of battery power, such as the display screen, access and Wifi scanning, Bluetooth, GPS, live wallpapers and so on. Roaming around on forums and stuff, I see a lot of people complaining about short battery time, and it is actually easy to understand them, but if they take a closer look at all the resources you mobile is using constantly, they wouldn't be surprised at all. Personally, I've resigned to charge my phone twice a day, when not working with it.

Nevertheless, I have a couple suggestions for you:

  1. I am not actually that familiar with how AlarmManager works, but I suppose you could decrease the frequency of scheduled alarms to save battery time. There are a lot of applications which start automatically, not sure they use this method, though!

  2. Use JuiceDeffender (I think) and JuicePlotter. These are apps which can monitor and plot the battery consumption in time.

  3. Make tests: In one day schedule the alarms, in another day, don't! Then analyse the battery level.

  4. Perhaps the folks in android.stackexchange.com have a deeper knowledge on Android power consumption. Ask them out!

Cheers!

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