@Override
  public void onReceive(Context context, Intent intent) {
    Options options = null;
    Bundle bundle = intent.getExtras();
    JSONObject args;

    try {
      args = new JSONObject(bundle.getString(OPTIONS));
      options = new Options(context).parse(args);
    } catch (JSONException e) {
      return;
    }

    this.context = context;
    this.options = options;

    // The context may got lost if the app was not running before
    LocalNotification.setContext(context);

    fireTriggerEvent();

    if (options.getInterval() == 0) {
      LocalNotification.unpersist(options.getId());
    } else if (isFirstAlarmInFuture()) {
      return;
    } else {
      LocalNotification.add(options.moveDate(), false);
    }

    Builder notification = buildNotification();

    showNotification(notification);
  }