Search code examples
androidalarmmanagerandroid-alarms

Android alarm canceled by another apps


I'm the android app developer that uses 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);

and I am using my app. and Tasker(https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)

  1. when i using Tasker , eneabled.
  2. I have tab on "Disable Tasker" on Tasker app. ( it lookes remove alarm of tasker..? )
  3. and then, my alarm has been canceld.

checked out by adb shell dumpsys alarm

Batch{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 Alarm clock: 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}}

has beed missing after "Disable Tasker"

what should I do keep my alarm for "Disable Tasker" ?


Solution

  • I've found the answer, leave for someone facing the same issue with me.

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

    has wrong.

    please set null into AlarmClockInfo's PendingIntent argument.

    fix like

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

    and I'm very sorry I don't know about the reason. please, someone, update the reason for this.

    thx.