How to check if Pending intent triggered by AlarmManager setRepeating is already running?

后端 未结 1 1317
广开言路
广开言路 2020-12-29 14:07

I would be glad to know how to check if Pending intent which is triggered by an Alarm Manager which starts an activity at a specific time given by AlarmManager.setRepeating?

1条回答
  •  醉梦人生
    2020-12-29 15:01

    Ok, I think i have managed to find out how,

    //CHECKING IF PENDING INTENT IS ALREADY RUNNING
    Intent checkIntent = new Intent(getApplicationContext(),MyScheduledReceiver.class);
    alarmUp = (PendingIntent.getBroadcast(getBaseContext(), 0, checkIntent, PendingIntent.FLAG_NO_CREATE) != null);
    

    Thanks, hope it might be helpful for someone...

    0 讨论(0)
提交回复
热议问题