1. Download our Official Android App: Forums for Android!

Java/Android: AlarmManager: cancel an user-defined alarm

Discussion in 'Android Development' started by E__Man, Oct 13, 2017.

  1. E__Man

    E__Man Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Oct 13, 2017

    Oct 13, 2017
    2
    0
    5
    Hello,

    I would like to cancel an alarm which was manually defined by the user (for example the next alarm to ring).
    I tried:
    alarmManager.cancel(alarmManager.getNextAlarmClock().getShowIntent());
    But this was ineffective.

    If getShowIntent() does not return the PendingIntent which may allow me to cancel the alarm, I don't know how to create one which would.
    Normally I should use:
    PendingIntent.getBroadcast(context, requestCode, intent, flags);
    but I don't know what arguments to give the function.

    Could you explain me how to cancel the next programmed alarm knowing it was manually defined by the user (or by another application)?

    Sincerely,
    E__Man.
     

    Advertisement

Share This Page

Loading...