Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 951
user5243421 Avatar asked Nov 28 '12 23:11

user5243421


1 Answers

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.

like image 97
nandeesh Avatar answered Nov 04 '22 19:11

nandeesh