首页 > 解决方案 > 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

  1. 当我使用 Tasker 时,启用。
  2. 我在 Tasker 应用程序上有“禁用 Tasker”选项卡。(它看起来消除了tasker的警报..?)
  3. 然后,我的闹钟被取消了。

签出者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”的警报?

标签: androidalarmmanagerandroid-alarms

解决方案


我找到了答案,请给与我面临同样问题的人。

AlarmManager.AlarmClockInfo clockInfo = new AlarmManager.AlarmClockInfo(timeWillbe, pendingIntent);

有错。

请在 AlarmClockInfo 的 PendingIntent 参数中设置 null。

修复喜欢

AlarmManager.AlarmClockInfo clockInfo = new AlarmManager.AlarmClockInfo(timeWillbe, null);

我很抱歉我不知道原因。请有人更新原因。

谢谢。


推荐阅读