I need to open an application for Android Android devices with some pre-populated data. The Iam usage logic seems to populate fields like:
- Event Description
- Event Location
- From date to date
- All day / not
- Repeat / Repeat Information
I canβt fill out the Reminders section, I would like to fill out the Reminders section. It will be great to help you with this.
Here is the code I use to open the Calendar application and populate the date.
// Intent to open Calendar Event Intent intent = new Intent(Intent.ACTION_INSERT) .setData(Events.CONTENT_URI); intent.putExtra(Events.DESCRIPTION, desc); intent.putExtra(Events.EVENT_LOCATION, location); intent.putExtra(Events.TITLE, summary); intent.putExtra(Events.EVENT_TIMEZONE, beginTime.getTimeZone().getID()); intent.putExtra(Events.STATUS, statusStr); intent.putExtra(Events.VISIBLE, transparency); intent.putExtra(Events.RRULE, "FREQ=YEARLY;INTERVAL=1;BYYEARDAY=1,2;UNTIL=20161210;"); intent.putExtra(Events.EXDATE, androidExDateStr.toString()); // Not sure on how to use CalendarContract.Reminders, Tried the following but does not seem to be working intent.putExtra(CalendarContract.Reminders.DESCRIPTION, desc); intent.putExtra(CalendarContract.Reminders.EVENT_LOCATION, location); intent.putExtra(CalendarContract.Reminders.TITLE, summary); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis()); intent.putExtra(CalendarContract.Reminders.DTSTART, beginTime.getTimeInMillis()); intent.putExtra(CalendarContract.Reminders.EVENT_TIMEZONE, beginTime.getTimeZone().getID()); intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis()); intent.putExtra(CalendarContract.Reminders.DTEND, endTime.getTimeInMillis()); intent.putExtra(CalendarContract.Reminders.STATUS, statusStr); intent.putExtra(CalendarContract.Reminders.RRULE,"FREQ=YEARLY;INTERVAL=1;BYYEARDAY=1,2;UNTIL=20161210;"); intent.putExtra(CalendarContract.Reminders.EXDATE, androidExDateStr.toString()); //intent.putExtra(CalendarContract.Reminders.METHOD, Reminders.METHOD_EMAIL); //intent.putExtra(CalendarContract.Reminders.MINUTES, reminderVal) ; //intent.putExtra(CalendarContract.Events.HAS_ALARM, 1); //} try { context.startActivity(intent); } catch(Exception e) { e.printStackTrace(); Log.v(LOG_TAG, "Cannot schedule Calendar event as specified "); return false; }
android calendar
user886827
source share