title: Android: Recurring reminder, before and after time
body: <p>I am developing an application in which I am setting reminder programmatically. The code of setting reminder is as follows : </p>
  
  <pre><code>private void addReminder(int statrYear, int startMonth, int startDay, int startHour, int startMinut, String title){
      // Convert start of begin time of reminder in milliseconds.
      Calendar beginTime = Calendar.getInstance();
      beginTime.set(statrYear, startMonth, startDay, startHour, startMinut);
      long startMillis = beginTime.getTimeInMillis();
  
      // String to access default google calendar of device for Event setting.
      String eventUriString = "content://com.android.calendar/events";
  
      // Creation of Event.
      ContentValues eventValues = new ContentValues();
      // Set calendar as 1 for default calendar.
      eventValues.put(Events.CALENDAR_ID, 1);
      // Set title as user define.
      eventValues.put(Events.TITLE, title);
      // Set description as user define.
      eventValues.put(Events.DESCRIPTION, "MYApp");
      // Set location as user define.
      eventValues.put(Events.EVENT_TIMEZONE, "India");
      // Set start time as system time or time converted in milliseconds.
      eventValues.put(Events.DTSTART, startMillis);
      // Set status of event as 1.
      eventValues.put("eventStatus", 1);
      // Set visibility of event as 3 (public).
      eventValues.put("visibility", 3);
      // Set transparency as 0. No other app seen through reminder.
      eventValues.put("transparency", 0);
      // Set alarm as 1. Ringing.
      eventValues.put(Events.HAS_ALARM, 1);
  
      // Set Event in calendar.
      Uri eventUri = getContentResolver().insert(Uri.parse(eventUriString), eventValues);
      // Getting ID of event in Long.
      long eventID = Long.parseLong(eventUri.getLastPathSegment());
  
      /***************** Event: Reminder(with alert) Adding reminder to event *******************/
      // String to access default google calendar of device for reminder setting.
      String reminderUriString = "content://com.android.calendar/reminders";      
      ContentValues reminderValues = new ContentValues();
  
      // Set reminder on Event ID.
      reminderValues.put("event_id", eventID);
      // Set reminder minute before.
      reminderValues.put("minutes", 1);
      // Set method of reminder
      reminderValues.put("method", 1);        
  
      @SuppressWarnings("unused")
      //Setting reminder in calendar on Event.
      Uri reminderUri = getContentResolver().insert(Uri.parse(reminderUriString), reminderValues);
  }
  </code></pre>
  
  <p>Now <strong>what should application do is :</strong> </p>
  
  <p><strong>1.</strong> i want to set reminders on options selected by the user, means if the user selects to set reminder one day before then the reminder should notify user one day before the reminder day.</p>
  
  <p><strong>2.</strong> Also want to set recurring reminder. Means after showing reminder on the date for which it sets, reminder should set for next time automatically depending in the recurring selected by the user.</p>
  
  <p><strong>3.</strong> After setting reminder by above code the reminder is visible in device calender. I want that the reminder should get set, but not visible in device before the time of its alarm.</p>
  
  <p>Please guide me with your suggestion.</p>