【问题标题】:Android alarm canceled by another appsAndroid 闹钟被其他应用取消
【发布时间】:2019-02-28 13:11:17
【问题描述】:

我是使用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=wararm:com.myapp.debug/com.myappNotiService type=0 whenElapsed=+1m24s525ms when=2019-02-25 09:57:28 窗口=0 重复间隔=0 计数=0 标志=0x3 闹钟: 触发时间=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”的警报?

【问题讨论】:

    标签: android alarmmanager android-alarms


    【解决方案1】:

    我已经找到答案了,请给和我遇到同样问题的人。

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

    错了。

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

    像这样修复

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

    非常抱歉,我不知道原因。请有人更新原因。

    谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多