android - Android 闹钟被其他应用取消
问题描述
我是使用的 android 应用程序开发人员AlarmManager
PendingIntent pendingIntent = PendingIntent.getService(FleetRefreshNotiService.this, 1, givenIntent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager.AlarmClockInfo clockInfo = new AlarmManager.AlarmClockInfo(timeWillbe, pendingIntent);
mAlarmManager.setAlarmClock(clockInfo, pendingIntent);
我正在使用我的应用程序。和塔斯克(https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)
- 当我使用 Tasker 时,启用。
- 我在 Tasker 应用程序上有“禁用 Tasker”选项卡。(它看起来消除了tasker的警报..?)
- 然后,我的闹钟被取消了。
签出者adb shell dumpsys alarm
批处理{2df386 num=1 start=598017988 end=598017988 flgs=0x3}:RTC_WAKEUP #0:Alarm{367b447 type 0 when 1551056248419 jc01rho.ogame.alarm.ognotifier.debug} tag= walarm :com.myapp.debug/com. myappNotiService type=0 whenElapsed=+1m24s525ms when=2019-02-25 09:57:28 window=0 repeatInterval=0 count=0 flags=0x3 闹钟:triggerTime=2019-02-25 09:57:28 showIntent=PendingIntent {1ff9474:PendingIntentRecord{c8fe766 com.myapp.debug startForegroundService}} 操作=PendingIntent{ec5bd9d:PendingIntentRecord{c8fe766 com.myapp.debug startForegroundService}}
“禁用Tasker”后丢失了
我应该怎么做才能保持“禁用Tasker”的警报?
解决方案
我找到了答案,请给与我面临同样问题的人。
AlarmManager.AlarmClockInfo clockInfo = new AlarmManager.AlarmClockInfo(timeWillbe, pendingIntent);
有错。
请在 AlarmClockInfo 的 PendingIntent 参数中设置 null。
修复喜欢
AlarmManager.AlarmClockInfo clockInfo = new AlarmManager.AlarmClockInfo(timeWillbe, null);
我很抱歉我不知道原因。请有人更新原因。
谢谢。
推荐阅读
- sql - 我如何表示一个由 3 个其他实体组成的实体?
- slack-api - 我怎样才能让它看起来像一个机器人正在输入松弛?
- blazor - Blazor、Debug.WriteLine 未输出到 Google Chrome 控制台
- c++ - Valgrind POSIX timer_create()“可能丢失”
- amazon-web-services - 有没有办法从当前资源生成 CloudFormation 模板?
- swift - 如何将数组作为表单数据传递给邮递员
- javascript - 无法使用 JavaScript 在 Appium 中使用 By.name 定位器单击元素
- python - TypeError:张量是不可散列的。相反,使用 tensor.ref() 作为键
- ios - 反应本机 Xcode 项目未启动
- javascript - 有没有办法在 Detox 中记录找到的值?