Is there a way to add reminders to a new calendar event using Intents?
Asked Answered
H

1

11

I need to support Android 2.1 and up. I know that CalendarContract isn't available in Android 2.1, so I've done the following workaround.

Intent intent = new Intent(Intent.ACTION_EDIT)
                        .setType("vnd.android.cursor.item/event")
                        .putExtra("beginTime", beginTime.getTimeInMillis())
                        .putExtra("title", title)
                        .putExtra("description", description)
                        .putExtra("eventLocation", location)
                        .putExtra("allDay", allDay)
                        .putExtra(Intent.EXTRA_EMAIL, email );
                if(!allDay) {
                    intent.putExtra("endTime", endTime.getTimeInMillis());
                }

               startActivity(intent);

This works very well so far. I've tested on 2.1 through 4.1.

I'd like to add reminders, too, but I can't find any documentation on how to do it using Intents. Does anyone have an example? I want to avoid adding more permissions to my manifest for writing to the calendar, so if you have a suggestion that requires that, I won't be able to use it.

Hymenium answered 28/11, 2012 at 23:47 Comment(2)
If you check the stock android source code, reeminder through intent cannot be added. But some OEMs could have implemented this. So even if you find it, it will not work on all phonesInhalator
@Inhalator I think this would best serve as an answer because it seems that that is true and is the case. I'd like to mark it as the answer if anyone else will corroborate.Hymenium
I
1

If you check the stock android Calendar source code, reminders cannot be added using intent.

Instead of this calendar has a setting to set the default reminder. But some OEMs could have implemented this. So even if you find it, it will not work on all phones.

Inhalator answered 17/12, 2012 at 6:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.