gpt4 book ai didi

android - Google Nexus 4 未调用警报管理器

转载 作者:行者123 更新时间:2023-11-29 17:49:12 26 4
gpt4 key购买 nike

我开发了一款 Android 应用。我需要为某些操作设置警报。

问题是警报接收器在所有其他设备上都能正常工作,但在 Google Nexus 4 上它有时会被调用但有时不会! :-(

当我设置闹钟时,它会打印如下日志,比当前时间晚 5 分钟。

Alarm set for : Fri Jun 20 06:07:00 GMT+00:00 2014

但是当时间到了时,它有时会被调用,有时却不会! :-(

我已将日志放入接收器,它有时会打印出来。

求助!谢谢!

最佳答案

自 API19 以来,警报管理器有点随机:

Note: Beginning with API 19 (KITKAT) alarm delivery is inexact: the OS will shift alarms in order to minimize wakeups and battery use. There are new APIs to support applications which need strict delivery guarantees; see setWindow(int, long, long, PendingIntent) and setExact(int, long, PendingIntent). Applications whose targetSdkVersion is earlier than API 19 will continue to see the previous behavior in which all alarms are delivered exactly when requested.

http://developer.android.com/reference/android/app/AlarmManager.html

关于android - Google Nexus 4 未调用警报管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24321194/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com