예제 #1
0
 /** Clear the local notification without canceling repeating alarms. */
 public void clear() {
   if (!isRepeating() && wasInThePast()) {
     unpersist();
   } else {
     getNotMgr().cancel(getId());
   }
 }
예제 #2
0
  /**
   * Cancel the local notification.
   *
   * <p>Create an intent that looks similar, to the one that was registered using schedule. Making
   * sure the notification id in the action is the same. Now we can search for such an intent using
   * the 'getService' method and cancel it.
   */
  public void cancel() {
    Intent intent = new Intent(context, receiver).setAction(options.getId());

    PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0);

    getAlarmMgr().cancel(pi);
    getNotMgr().cancel(options.getIdAsInt());

    unpersist();
  }