0

I use the code below to open calendar app with populated data to save the event.

    private fun saveEventToCalendar() {
        val calIntent = Intent(Intent.ACTION_INSERT)
        calIntent.type = "vnd.android.cursor.item/event";
        calIntent.putExtra(CalendarContract.Events.TITLE, selectedEvent.title.capitalize())
        calIntent.putExtra(CalendarContract.Events.EVENT_LOCATION, selectedEvent.venue.capitalizeWords())
        calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, selectedEvent.dateTimeStart.time)
        calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, selectedEvent.dateTimeFinish.time)
        calIntent.putExtra(CalendarContract.Events.DESCRIPTION, "additional info here")
        startActivityForResult(Intent.createChooser(calIntent,"Create Reminder using"), INTENT_SAVE_EVENT_TO_CALENDAR)
    }

but as a result, the default alarm notification time is set to be 30 minutes before, as you can see the image below, I want to make it 2 hours before the event start. how to do that ?

java or kotlin is ok

enter image description here

Alexa289
  • 8,089
  • 10
  • 74
  • 178

0 Answers0