Uzyskaj listę zarejestrowanych intencji oczekujących w systemie operacyjnym Android

Rejestruję alarmy, które planuję wykonać w określonym czasie i może to być wiele alarmów w zależności od wielkości listy zaplanowanej. Ale mam dwa pytania, które pozostają dla mnie niejasne:

1) Jak mogę wysłać zapytanie do systemu operacyjnego o rejestrację Pending Intents I? Potrzebuję tego do testowania. Kod psudo tego, co chcę, byłby mniej więcej taki:

List<PendingIntent> intentsInOS = context.getAllPendingIntentsOfType(AppConstants.INTENT_ALARM_SCHEDULE));

2) Zobacz oczekujące intencje, które tworzę, dostarczam akcję i dodatkowe dane (identyfikator harmonogramu).

private Intent getSchedeuleIntent(Integer id) {

    Intent intent = new Intent(AppConstants.INTENT_ALARM_SCHEDULE);
    intent.putExtra(AppConstants.INTENT_ALARM_SCHEDULE_EXTRA, id);

    return intent;
}

Ale mówimy również, że zamiar ma FLAG_CANCEL_CURRENT. Czy anuluje wszystkie oczekujące zamiary z tą samą akcją, czy też musi mieć tę samą akcję I dodatkowe dane?

PendingIntent pendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 0, getSchedeuleIntent(schedule.id), PendingIntent.FLAG_CANCEL_CURRENT);

Mój kod

@Override
public void run() {

    List<ScheduledLocation> schedules = dbManager.getScheduledLocations();
    if(schedules == null || schedules.isEmpty()){
        return;
    }

    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    //alarmManager.

    // we need to get the number of milliseconds from current time till next hour:minute the next day.
    for(ScheduledLocation schedule : schedules){

        long triggerAtMillis = DateUtils.millisecondsBetweenNowAndNext(now, schedule.hour, schedule.minute, schedule.day);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 0, getSchedeuleIntent(schedule.id), PendingIntent.FLAG_CANCEL_CURRENT);

        alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtMillis, MILLISECONDS_IN_WEEK, pendingIntent);
    }

    // List<PendingIntent> intentsInOS = context.getAllPendingIntentsOfType(AppConstants.INTENT_ALARM_SCHEDULE));

}


private Intent getSchedeuleIntent(Integer id) {

    Intent intent = new Intent(AppConstants.INTENT_ALARM_SCHEDULE);
    intent.putExtra(AppConstants.INTENT_ALARM_SCHEDULE_EXTRA, id);

    return intent;
}

questionAnswers(1)

yourAnswerToTheQuestion