I have a small application in which one of the functions includes the current state for the user. This is shown to other users using our backend, and in some cases it is also necessary to have state synchronization with the user's calendar.
I use the ICS: s calendar API to perform this synchronization, and it works well with Google Calendar. If the user chooses to synchronize with the exchange account, however, the status elements are displayed as meeting requests with a preliminary status.
Since I have limited experience with calendars, my question is which fields should go with a calendar event, so that it appears as a regular event in the exchange, as well as the Google calendar. I insert events directly, without using intentions, because the goal is to make it easy for the user. The current code looks like this (status is my state data model).
ContentResolver cr = getContentResolver(); ContentValues values = new ContentValues(); values.put(CalendarContract.Events.DTSTART, status.StartTimeLocal.getTime()); values.put(CalendarContract.Events.DTEND, status.StopTimeLocal.getTime()); values.put(CalendarContract.Events.TITLE, status.DisplayName); values.put(CalendarContract.Events.DESCRIPTION, status.Text); values.put(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY); values.put(CalendarContract.Events.STATUS, CalendarContract.Events.STATUS_CONFIRMED); values.put(CalendarContract.Events.GUESTS_CAN_INVITE_OTHERS, false); values.put(CalendarContract.Events.HAS_ATTENDEE_DATA, false); values.put(CalendarContract.Events.CALENDAR_ID, mCalendarId); values.put(CalendarContract.Events.EVENT_TIMEZONE, "Europe/Stockholm"); Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values);
When I try to add a new item manually to the phone calendar, it synchronizes correctly with the exchange, so it seems possible. But from my application, itβs not easy for me to make it work.
source share