Android闹钟已被其他应用取消

时间:2019-02-25 01:13:40

标签: android alarmmanager android-alarms

我是使用AlarmManager

的android应用程序开发人员
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开始= 598017988结束= 598017988 flgs = 0x3}:     RTC_WAKEUP#0:警报​​{367b447,当1551056248419 jc01rho.ogame.alarm.ognotifier.debug时输入0)       tag = 警报:com.myapp.debug / com.myappNotiService       类型= 0 whenElapsed = + 1m24s525ms when = 2019-02-25 09:57:28       窗口= 0 repeatInterval = 0计数= 0标志= 0x3       闹钟:         triggerTime = 2019-02-25 09:57:28         showIntent = PendingIntent {1ff9474:PendingIntentRecord {c8fe766 com.myapp.debug startForegroundService}}       operation = PendingIntent {ec5bd9d:PendingIntentRecord {c8fe766 com.myapp.debug startForegroundService}}

在“禁用Tasker”之后丢失了

对于“禁用Tasker”,我该怎么办?

1 个答案:

答案 0 :(得分:0)

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

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

错了。

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

修复

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

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

thx。