Problem while creating reminder for recurring events in Google Calendar like “twice a day”, “Thrice a...












1















I am trying to set recurring reminders for a particular event as in the image. Code works correctly but there is something happening which is changing create events. Please check details as below.



If I try setting reminders from loop, it works, but with recurrence there is an issue as mentioned.



It's correct time which is selected



Check for first two reminders shown on the image were timed perfectly when they were set using this code snippet.



but after like 30 secs it all changed back to the same time.
Check Time For Events now



I have to set reminders for different events like twice a day, thrice a day and all




Please check code snippet as below (For an Event occurring Twice a Day):




       Uri uri;
Uri EVENTS_URI = Uri.parse(getCalendarUriBase().toString());
Calendar current = Calendar.getInstance();
current.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
ContentResolver cr = mActivity.getContentResolver();
ContentValues values = new ContentValues();
TimeZone timeZone = TimeZone.getDefault();
values.put("calendar_id", calId);
values.put("title", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
values.put("description", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
values.put("eventLocation", "Medication Area");
long startTime = ((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L);
values.put(CalendarContract.Events.DTSTART, startTime);
Calendar endDate = Calendar.getInstance();
long endtime = (TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time);
endDate.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
values.put(CalendarContract.Events.DURATION, "+PT30M");
values.put("allDay", 0);
values.put("rrule", "FREQ=DAILY;BYHOUR=18,6;UNTIL=20181129");
values.put("eventTimezone", timeZone.getID());
values.put(CalendarContract.Events.HAS_ALARM, 1);
values.put(CalendarContract.Events.EVENT_COLOR, ContextCompat.getColor(getActivity(), R.color.app_purple));
uri = cr.insert(EVENTS_URI, values);
Log.e("Uri:::", uri.getLastPathSegment());


Thanks.










share|improve this question





























    1















    I am trying to set recurring reminders for a particular event as in the image. Code works correctly but there is something happening which is changing create events. Please check details as below.



    If I try setting reminders from loop, it works, but with recurrence there is an issue as mentioned.



    It's correct time which is selected



    Check for first two reminders shown on the image were timed perfectly when they were set using this code snippet.



    but after like 30 secs it all changed back to the same time.
    Check Time For Events now



    I have to set reminders for different events like twice a day, thrice a day and all




    Please check code snippet as below (For an Event occurring Twice a Day):




           Uri uri;
    Uri EVENTS_URI = Uri.parse(getCalendarUriBase().toString());
    Calendar current = Calendar.getInstance();
    current.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
    ContentResolver cr = mActivity.getContentResolver();
    ContentValues values = new ContentValues();
    TimeZone timeZone = TimeZone.getDefault();
    values.put("calendar_id", calId);
    values.put("title", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
    values.put("description", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
    values.put("eventLocation", "Medication Area");
    long startTime = ((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L);
    values.put(CalendarContract.Events.DTSTART, startTime);
    Calendar endDate = Calendar.getInstance();
    long endtime = (TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time);
    endDate.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
    values.put(CalendarContract.Events.DURATION, "+PT30M");
    values.put("allDay", 0);
    values.put("rrule", "FREQ=DAILY;BYHOUR=18,6;UNTIL=20181129");
    values.put("eventTimezone", timeZone.getID());
    values.put(CalendarContract.Events.HAS_ALARM, 1);
    values.put(CalendarContract.Events.EVENT_COLOR, ContextCompat.getColor(getActivity(), R.color.app_purple));
    uri = cr.insert(EVENTS_URI, values);
    Log.e("Uri:::", uri.getLastPathSegment());


    Thanks.










    share|improve this question



























      1












      1








      1








      I am trying to set recurring reminders for a particular event as in the image. Code works correctly but there is something happening which is changing create events. Please check details as below.



      If I try setting reminders from loop, it works, but with recurrence there is an issue as mentioned.



      It's correct time which is selected



      Check for first two reminders shown on the image were timed perfectly when they were set using this code snippet.



      but after like 30 secs it all changed back to the same time.
      Check Time For Events now



      I have to set reminders for different events like twice a day, thrice a day and all




      Please check code snippet as below (For an Event occurring Twice a Day):




             Uri uri;
      Uri EVENTS_URI = Uri.parse(getCalendarUriBase().toString());
      Calendar current = Calendar.getInstance();
      current.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
      ContentResolver cr = mActivity.getContentResolver();
      ContentValues values = new ContentValues();
      TimeZone timeZone = TimeZone.getDefault();
      values.put("calendar_id", calId);
      values.put("title", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
      values.put("description", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
      values.put("eventLocation", "Medication Area");
      long startTime = ((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L);
      values.put(CalendarContract.Events.DTSTART, startTime);
      Calendar endDate = Calendar.getInstance();
      long endtime = (TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time);
      endDate.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
      values.put(CalendarContract.Events.DURATION, "+PT30M");
      values.put("allDay", 0);
      values.put("rrule", "FREQ=DAILY;BYHOUR=18,6;UNTIL=20181129");
      values.put("eventTimezone", timeZone.getID());
      values.put(CalendarContract.Events.HAS_ALARM, 1);
      values.put(CalendarContract.Events.EVENT_COLOR, ContextCompat.getColor(getActivity(), R.color.app_purple));
      uri = cr.insert(EVENTS_URI, values);
      Log.e("Uri:::", uri.getLastPathSegment());


      Thanks.










      share|improve this question
















      I am trying to set recurring reminders for a particular event as in the image. Code works correctly but there is something happening which is changing create events. Please check details as below.



      If I try setting reminders from loop, it works, but with recurrence there is an issue as mentioned.



      It's correct time which is selected



      Check for first two reminders shown on the image were timed perfectly when they were set using this code snippet.



      but after like 30 secs it all changed back to the same time.
      Check Time For Events now



      I have to set reminders for different events like twice a day, thrice a day and all




      Please check code snippet as below (For an Event occurring Twice a Day):




             Uri uri;
      Uri EVENTS_URI = Uri.parse(getCalendarUriBase().toString());
      Calendar current = Calendar.getInstance();
      current.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
      ContentResolver cr = mActivity.getContentResolver();
      ContentValues values = new ContentValues();
      TimeZone timeZone = TimeZone.getDefault();
      values.put("calendar_id", calId);
      values.put("title", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
      values.put("description", getString(R.string.app_name) + " - " + mBinder.etSearch.getText().toString().trim());
      values.put("eventLocation", "Medication Area");
      long startTime = ((TimeStamp.formatToSeconds(mBinder.etStartDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L);
      values.put(CalendarContract.Events.DTSTART, startTime);
      Calendar endDate = Calendar.getInstance();
      long endtime = (TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time);
      endDate.setTimeInMillis(((TimeStamp.formatToSeconds(mBinder.etEndDate.getText().toString().trim(), DATE_FORMAT_FOR_SHIFT) + time) * 1000L));
      values.put(CalendarContract.Events.DURATION, "+PT30M");
      values.put("allDay", 0);
      values.put("rrule", "FREQ=DAILY;BYHOUR=18,6;UNTIL=20181129");
      values.put("eventTimezone", timeZone.getID());
      values.put(CalendarContract.Events.HAS_ALARM, 1);
      values.put(CalendarContract.Events.EVENT_COLOR, ContextCompat.getColor(getActivity(), R.color.app_purple));
      uri = cr.insert(EVENTS_URI, values);
      Log.e("Uri:::", uri.getLastPathSegment());


      Thanks.







      android google-calendar-api android-calendar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 17 at 5:59







      Deep Patel

















      asked Nov 21 '18 at 7:00









      Deep PatelDeep Patel

      1,7782722




      1,7782722
























          1 Answer
          1






          active

          oldest

          votes


















          1














          If you think that the cause of a problem is due to a bug in the service itself, you can search the Issue Tracker to determine if it is a known issue. If the issue is completely new, you can report it on the Issue Tracker as well.






          share|improve this answer
























          • Thanks for your suggestion, I will do that and let's see if someone can help me with this

            – Deep Patel
            Nov 22 '18 at 10:22











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406777%2fproblem-while-creating-reminder-for-recurring-events-in-google-calendar-like-tw%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          If you think that the cause of a problem is due to a bug in the service itself, you can search the Issue Tracker to determine if it is a known issue. If the issue is completely new, you can report it on the Issue Tracker as well.






          share|improve this answer
























          • Thanks for your suggestion, I will do that and let's see if someone can help me with this

            – Deep Patel
            Nov 22 '18 at 10:22
















          1














          If you think that the cause of a problem is due to a bug in the service itself, you can search the Issue Tracker to determine if it is a known issue. If the issue is completely new, you can report it on the Issue Tracker as well.






          share|improve this answer
























          • Thanks for your suggestion, I will do that and let's see if someone can help me with this

            – Deep Patel
            Nov 22 '18 at 10:22














          1












          1








          1







          If you think that the cause of a problem is due to a bug in the service itself, you can search the Issue Tracker to determine if it is a known issue. If the issue is completely new, you can report it on the Issue Tracker as well.






          share|improve this answer













          If you think that the cause of a problem is due to a bug in the service itself, you can search the Issue Tracker to determine if it is a known issue. If the issue is completely new, you can report it on the Issue Tracker as well.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 '18 at 8:03









          abielitaabielita

          9,6122940




          9,6122940













          • Thanks for your suggestion, I will do that and let's see if someone can help me with this

            – Deep Patel
            Nov 22 '18 at 10:22



















          • Thanks for your suggestion, I will do that and let's see if someone can help me with this

            – Deep Patel
            Nov 22 '18 at 10:22

















          Thanks for your suggestion, I will do that and let's see if someone can help me with this

          – Deep Patel
          Nov 22 '18 at 10:22





          Thanks for your suggestion, I will do that and let's see if someone can help me with this

          – Deep Patel
          Nov 22 '18 at 10:22




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406777%2fproblem-while-creating-reminder-for-recurring-events-in-google-calendar-like-tw%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?